MATLAB: Pick column and row of an entry

columnrow

Hi, i would like to know is there any function which allow me to pick matrix entries greater than 10 and print those entries rows and columns in cells or in 2 separate matrices?

Best Answer

X = randi(20,10);
[I,J] = ind2sub(size(X),find(X>10));
The I vector has the row indices, the J vector has the column indices. You can certainly store those indices however you like.