get rid off redundant values

5 ビュー (過去 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 Center および File ExchangeHistorical Contests についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by