get rid off redundant values

조회 수: 3 (최근 30일)
Shamim Al Mamun
Shamim Al Mamun 2016년 7월 4일
편집: Thorsten 2016년 7월 4일
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?

답변 (2개)

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

댓글을 달려면 로그인하십시오.


Thorsten
Thorsten 2016년 7월 4일
편집: Thorsten 2016년 7월 4일
B = unique(A, 'rows');
or, if you need the same order in the matrix
B = unique(A, 'rows', 'stable');

카테고리

Help CenterFile Exchange에서 Historical Contests에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by