get rid off redundant values

2 vues (au cours des 30 derniers jours)
Shamim Al Mamun
Shamim Al Mamun le 4 Juil 2016
Modifié(e) : Thorsten le 4 Juil 2016
I have a matrix of thousands values. but i get same value in a multiple rows. i want to delete all this redundant values from this array. how can i make it?

Réponses (2)

Walter Roberson
Walter Roberson le 4 Juil 2016
mask = YourMatrix(:,:,3) == 0 & (YourMatrix(:,:,1) ~= 0 | YourMatrix(:,:,2) ~= 0);
YourMatrix(mask,:) = [];
  2 commentaires
Shamim Al Mamun
Shamim Al Mamun le 4 Juil 2016
Thanks a lot. but it says "Index exceeds matrix dimensions.". what's the problem walter.
Walter Roberson
Walter Roberson le 4 Juil 2016
mask = YourMatrix(:,3) == 0 & (YourMatrix(:,1) ~= 0 | YourMatrix(:,2) ~= 0);
YourMatrix(mask,:) = [];

Connectez-vous pour commenter.


Thorsten
Thorsten le 4 Juil 2016
Modifié(e) : Thorsten le 4 Juil 2016
B = unique(A, 'rows');
or, if you need the same order in the matrix
B = unique(A, 'rows', 'stable');

Catégories

En savoir plus sur Historical Contests dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by