Find columns with same values in matrix
Show older comments
Hi,
I actually struggle on a fast and good solution on finding columns in an 2D matrix containing same values and returning the row index of those columns.
% Example:
A = [2,2,7,3; ...
8,7,8,10; ...
4,3,5,2; ...
6,7,1,9];
Result should be 2 and 4 because in column 2 the number 7 occurs two times. Is there anything similar to unique or anything else? I try to avoid looping every column with unique since there will be a lot of matrices and bigger ones.
Thanks a lot!
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!