get rid off redundant values

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?

Respuestas (2)

Walter Roberson
Walter Roberson el 4 de Jul. de 2016

0 votos

mask = YourMatrix(:,:,3) == 0 & (YourMatrix(:,:,1) ~= 0 | YourMatrix(:,:,2) ~= 0);
YourMatrix(mask,:) = [];

2 comentarios

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

Iniciar sesión para comentar.

Thorsten
Thorsten el 4 de Jul. de 2016
Editada: Thorsten el 4 de Jul. de 2016

0 votos

B = unique(A, 'rows');
or, if you need the same order in the matrix
B = unique(A, 'rows', 'stable');

Categorías

Más información sobre Historical Contests en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 4 de Jul. de 2016

Editada:

el 4 de Jul. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by