Effacer les filtres
Effacer les filtres

find the repetition of matrix rows

2 vues (au cours des 30 derniers jours)
yousef Yousef
yousef Yousef le 8 Mai 2014
Commenté : yousef Yousef le 8 Mai 2014
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

Réponse acceptée

the cyclist
the cyclist le 8 Mai 2014
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);
  1 commentaire
yousef Yousef
yousef Yousef le 8 Mai 2014
Thanks a lot for this help

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by