find the repetition of matrix rows

1 次查看(过去 30 天)
I want to find out if the row i of mxn matrix is repeated ,the code should give logic 1.Otherwise zero"there are many ways but Im searching for the best one" Thanks

采纳的回答

the cyclist
the cyclist 2014-5-8
Using the algorithm that Jan Simon posted in this Answer.
% Example of data
X = [6 5 4;
1 2 3;
1 2 3;
1 2 4;
1 2 3];
[~,~,A] = unique(X,'rows','stable');
[n, bin] = histc(A, unique(A));
multiple = find(n > 1);
indexToDuplicate = ismember(bin, multiple);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by