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?

Answers (2)

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

2 Comments

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,:) = [];

Sign in to comment.

Thorsten
Thorsten on 4 Jul 2016
Edited: Thorsten on 4 Jul 2016
B = unique(A, 'rows');
or, if you need the same order in the matrix
B = unique(A, 'rows', 'stable');

Categories

Find more on Historical Contests in Help Center and File Exchange

Asked:

on 4 Jul 2016

Edited:

on 4 Jul 2016

Community Treasure Hunt

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

Start Hunting!