get rid off redundant values
Ältere Kommentare anzeigen
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?

Antworten (2)
Walter Roberson
am 4 Jul. 2016
mask = YourMatrix(:,:,3) == 0 & (YourMatrix(:,:,1) ~= 0 | YourMatrix(:,:,2) ~= 0);
YourMatrix(mask,:) = [];
2 Kommentare
Shamim Al Mamun
am 4 Jul. 2016
Walter Roberson
am 4 Jul. 2016
mask = YourMatrix(:,3) == 0 & (YourMatrix(:,1) ~= 0 | YourMatrix(:,2) ~= 0);
YourMatrix(mask,:) = [];
B = unique(A, 'rows');
or, if you need the same order in the matrix
B = unique(A, 'rows', 'stable');
Kategorien
Mehr zu Historical Contests finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!