I have a matrix lets say
x = 2 2 3 4 3 2 6 4 8
now I want to get the location of a number 4. I want ans like this :
ans
ans=(2,1) (3,2)
as these are the locations for 4 in matrix.
Use find:
find
[i,j] = find(x == 4)
1.4m articles
1.4m replys
5 comments
57.0k users