MATLAB: Finding the index of spesific element in a matrix

indexmatrix

Lets say we have matrix:
a=[ 2, 3, 5
3, 4, 7
4, 4, 4] ;
I want to know index of a(4) which is the bold 3. This is just an example. I want to learn how to find index of a(n).

Best Answer

Assuming you want to index of the last match in the matrix:
Index=find(a==3,1,'last')