How to find unique elements from every row within matrix??
5 ビュー (過去 30 日間)
古いコメントを表示
y = [ 90 90 -45 0 0 45 45 0 -45 15 30 -30 75 -45 75 -75
90 90 -45 0 0 -45 -45 0 -45 15 30 -30 75 -45 75 -45
90 90 -45 0 0 45 45 0 -45 15 30 -30 75 -45 75 -30
90 90 -45 0 0 45 45 0 -45 15 30 -30 75 -45 75 0
90 90 -45 0 0 45 45 0 -45 15 30 -30 75 -45 75 15
90 90 -45 0 0 45 45 0 -45 15 30 -30 75 -45 75 30
90 90 45 0 0 45 45 0 45 15 30 -30 75 45 75 45
90 90 -45 0 0 45 45 0 -45 15 30 -30 75 -45 75 75
90 90 -45 0 0 45 45 0 -45 15 30 -30 75 -45 75 90];
unique(y) =9;
Please tell me to count unique value in every row, and if unique elements in row less than 9, that row should be deleted.
0 件のコメント
採用された回答
Andrei Bobrov
2016 年 2 月 29 日
y0 = sort(y,2);
out = y(sum([ones(size(y,1),1),diff(y0,[],2)~=0],2) >= 9,:);
1 件のコメント
Andrei Bobrov
2016 年 2 月 29 日
use
out = y(sum([ones(size(y,1),1),diff(y0,[],2)~=0],2) >= ...
numel(unique(y)),:);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surrogate Optimization についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!