Date: Jun 24, 2013 5:16 AM
Author: Nasser Abbasi
Subject: Re: finding index of any element in a matrix

On 6/24/2013 4:11 AM, asif khan wrote:
> I have a matrix
> A = [3 5 8;
> 5 1 3;
> 9 4 7]
>
> i want to find the index of the 4 from the above matrix...
>
> by seeing the matrix, we can say it is r=3 & c=2.
>
> i want to get it by using command...
>



If you use the find() command with [I,J] as return values,
you will get the result.

EDU>> [I,J]=find(A==4)

I =

3


J =

2