フィルターのクリア

How to find unique lines in cell arrays

1 回表示 (過去 30 日間)
Artyom
Artyom 2013 年 8 月 7 日
How to find unique lines in the next cell array:
15 'm'
18 'm'
15 'm'
So the result will be:
15 'm'
18 'm'

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 7 日
use unique function
  2 件のコメント
Artyom
Artyom 2013 年 8 月 7 日
Unique works only with cell array of strings.
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 8 月 7 日
a={15 'm'; 18 'm'; 15 'm';13 'r';15 'm'}
b=cellfun(@num2str,a,'un',0)
c=arrayfun(@(x) horzcat(b{x,:}),(1:size(a,1))','un',0)
[idx,idx]=unique(c)
out=a(idx,:)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by