MATLAB: Searching matrix for a particular value and ploting it

matrix search

hi there. Say I have a matrix A = [1 2 3; 2 1 5; 6 7 5;8 2 1]. and i want to search for the value '1' in the matrix then plot it according to the row and column it occurs in.
ex: the x,y coordinates for plotting would be:
(1,1) ==> 1 for the row and 1 for the column (2,2) ==> 2 for the row and 2 for the column (0,0) ==> nothing because there is no 1 in this row (4,3) ==> 4 for the row and 3 for the column
any help would be appreciated. thnx in advance

Best Answer

A = [1 2 3; 2 1 5; 6 7 5;8 2 1];
[row,col] = find(A == 1);
or
[row,col] = find(abs(A - 1) < eps(100));
out = [row,col];