From: Snow White on
Hello,


I have two matrices I and R, i want to find values that are equal to a certain value in I and then find the values at the extracted locations in R as well.

I am using the following code:

[r,c]=find(I==cut_off_val);

to extract values from I (3xn) but find does not traverse row wise it traverses column wise apart from that how do i extract the values from R (3xn (which are a byproduct of I so i can not use intersect))

bye
From: Andy on
"Snow White" <gulesaman(a)gmail.com> wrote in message <i26rbs$hbf$1(a)fred.mathworks.com>...
> Hello,
>
>
> I have two matrices I and R, i want to find values that are equal to a certain value in I and then find the values at the extracted locations in R as well.
>
> I am using the following code:
>
> [r,c]=find(I==cut_off_val);
>
> to extract values from I (3xn) but find does not traverse row wise it traverses column wise apart from that how do i extract the values from R (3xn (which are a byproduct of I so i can not use intersect))
>
> bye

I'm having trouble following your question. Could you provide a small sample I, R, and cut_off_val, and show us what the desired output would look like?
From: dpb on
Snow White wrote:
> Hello,
>
>
> I have two matrices I and R, i want to find values that are equal to a
> certain value in I and then find the values at the extracted locations
> in R as well.
>
> I am using the following code:
>
> [r,c]=find(I==cut_off_val);
>
> to extract values from I (3xn) but find does not traverse row wise it
> traverses column wise apart from that how do i extract the values from R
> (3xn (which are a byproduct of I so i can not use intersect))

v = R(sub2ind(size(I),r,c));

--
From: dpb on
dpb wrote:
> Snow White wrote:
>> Hello,
>>
>>
>> I have two matrices I and R, i want to find values that are equal to a
>> certain value in I and then find the values at the extracted locations
>> in R as well.
>>
>> I am using the following code:
>>
>> [r,c]=find(I==cut_off_val);
>>
>> to extract values from I (3xn) but find does not traverse row wise it
>> traverses column wise apart from that how do i extract the values from
>> R (3xn (which are a byproduct of I so i can not use intersect))
>
> v = R(sub2ind(size(I),r,c));
....

I'll add the caveat about searching for exact matches on floating point
values just in case...

--
From: us on
"Snow White" <gulesaman(a)gmail.com> wrote in message <i26rbs$hbf$1(a)fred.mathworks.com>...
> Hello,
>
>
> I have two matrices I and R, i want to find values that are equal to a certain value in I and then find the values at the extracted locations in R as well.
>
> I am using the following code:
>
> [r,c]=find(I==cut_off_val);
>
> to extract values from I (3xn) but find does not traverse row wise it traverses column wise apart from that how do i extract the values from R (3xn (which are a byproduct of I so i can not use intersect))
>
> bye

show CSSM a SMALL yet exemplary data set of your input/desired output...

us