From: Ish Khan on
Hi, I have matrix and i want to find the coordinate of the first 1 that appeared in the matrix, that is row and column number, here is my code so far,
D =

0 0 0 1 0 1 0
0 0 0 0 1 0 0
0 0 0 0 0 0 1
0 1 0 0 0 0 0

>> [m,n] = size (D)

m =

4


n =

7

>> G = find (D, m, 'first')

G =

8
13
18
21

>> G = min(find(D,m,'first'))

G =

8
I need to gewt the row and column number of this 8, which should be m = 4 and n= 2, but i don't know how to, i know its preety basic, but please help me!
From: Jeff K on
>> [x y]=find(D==1,1,'first')
x =
4
y =
2

Here you go!
From: Ish Khan on
"Jeff K" <mesta2000(a)hotmail.com> wrote in message <i1m8ic$501$1(a)fred.mathworks.com>...
> >> [x y]=find(D==1,1,'first')
> x =
> 4
> y =
> 2
>
> Here you go!

Thank you soooooo much!!! you are a life saver!!!!!