What I'm trying to do: given a 2D matrix, get the column indices of the elements in each row that satisfy a certain condition.
For example, let's say my matrix
M = [16 2 3 13; 5 11 10 8; 9 7 6 12; 4 14 15 1]
and my condition M>6. Then my desired result will be something like
Indices = {[1 4]'; [2 3 4]'; [1 2 4]'; [2 3]';}
After reading the answers to this similar question, I came up with this partial solution using findand accumarray:
[ix, iy] = find(M>6);
Indices = accumarray(ix,iy,[],@(iy){iy});
, - , , , . , Indices{2} = [2 4 3]' [2 3 4]', , . ix 3 2, 3, 6 9. iy 2, 3 4 . ? ? , , Indices ??