Counting unique values across the columns of a matrix
古いコメントを表示
How can I store indices of columns in a matrix containing more than 3 unique values? for example if: X =
8 2 1 11 0
8 10 11 3 4
9 14 6 1 4
4 3 15 11 0
I want Y=[2 3]
採用された回答
その他の回答 (1 件)
Andrei Bobrov
2015 年 7 月 24 日
[~,ii] = mode(X);
out = find(size(X,1) - ii >= 3);
2 件のコメント
Matt Talebi
2015 年 7 月 24 日
Andrei Bobrov
2015 年 7 月 24 日
編集済み: Andrei Bobrov
2015 年 7 月 24 日
>> X = [
8 2 1 11 0
8 10 11 3 4
9 14 6 1 4
4 3 15 11 0];
>> [~,ii] = mode(X);
>> out = find(size(X,1) - ii >= 3)
out =
2 3
>> out = find(size(X,1) - ii > 3)
out = [](1x0) % solution in Octave (now I can't use MATLAB)
>>
カテゴリ
ヘルプ センター および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!