フィルターのクリア

How to Select a distinct subset of a CellArray

1 回表示 (過去 30 日間)
Léon
Léon 2013 年 6 月 17 日
Hello,
please consider the following problem:
x = {1,1;1,2;1,3;2,1;2,2}
[C,IA,IC] = unique(x(:,1))
C(1) % ==> is 1, now I want to get all rows of x where we have a 1 in the first column.
Would be super glad to get a tip how to achieve that!

回答 (2 件)

David Sanchez
David Sanchez 2013 年 6 月 17 日
v = find(x(:,1)==C(1))

Andrei Bobrov
Andrei Bobrov 2013 年 6 月 17 日
x = [1,1;1,2;1,3;2,1;2,2];
out = x(x(:,1) == 1,:);

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by