Hi,
I have a matrix of N-by-M with integers. I need to efficiently find the indices for all of the unique elements in the matrix. The solution I have is via a "for" loop:
uM = unique (M(:));for i = 1 : length(uM) I(i) = find(M == uM(i)); end
This works fine, but with a large matrix, this is slow. I wonder if there are better solutions. thanks very much!
Best Answer