Thread Subject: finding common indices from two matrices

Subject: finding common indices from two matrices

From: OJ Raqueno

Date: 12 Nov, 2009 10:48:02

Message: 1 of 3

Suppose I have two matrices:

A =
    1.1140 2.5294 1.1140 3.8287
    3.6232 0.3902 1.1140 1.9415
    0.5079 1.1140 0.6305 3.2011
    3.6535 2.1875 1.1140 0.5675

B =

    1.6870 3.3965 2.7149 2.6219
    3.6629 0.1428 3.0310 3.3965
    3.3965 3.3965 2.9725 2.8242
    3.8380 3.7360 1.5689 3.3965

Suppose I want to find the common index from which the value in A is, say, 1.1140, and 3.3965 in B. That index is [3,2] in the given, but what program can be written to determine this? Basically I want to generalize this for larger matrices. I've tried nested for and if loops, but can't seem to find the right commands.

Thanks!

Subject: finding common indices from two matrices

From: Joe Nunes

Date: 12 Nov, 2009 10:52:01

Message: 2 of 3

"OJ Raqueno" <lopuijk@yahoo.com> wrote in message <hdgp52$qba$1@fred.mathworks.com>...
> Suppose I have two matrices:
>
> A =
> 1.1140 2.5294 1.1140 3.8287
> 3.6232 0.3902 1.1140 1.9415
> 0.5079 1.1140 0.6305 3.2011
> 3.6535 2.1875 1.1140 0.5675
>
> B =
>
> 1.6870 3.3965 2.7149 2.6219
> 3.6629 0.1428 3.0310 3.3965
> 3.3965 3.3965 2.9725 2.8242
> 3.8380 3.7360 1.5689 3.3965
>
> Suppose I want to find the common index from which the value in A is, say, 1.1140, and 3.3965 in B. That index is [3,2] in the given, but what program can be written to determine this? Basically I want to generalize this for larger matrices. I've tried nested for and if loops, but can't seem to find the right commands.

have a look to ismember ...

help ismember

regards
>
> Thanks!

Subject: finding common indices from two matrices

From: OJ Raqueno

Date: 12 Nov, 2009 12:22:01

Message: 3 of 3

> have a look to ismember ...
>
> help ismember
>
> regards

Thanks a bunch!

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
matrix index OJ Raqueno 12 Nov, 2009 05:49:04
rssFeed for this Thread

Contact us at files@mathworks.com