How can I remove duplicate values from cell array?

I have this problem
S={ 1 2, 2 3 }
how delete duplicate value:
S becomes {1 2 3 }

 採用された回答

Nicolas B.
Nicolas B. 2019 年 11 月 11 日
編集済み: Nicolas B. 2019 年 11 月 11 日

0 投票

Does the function unique() solve your problem?
So in your case, because you have a cell array:
S = {1 2 2 3};
S = num2cell(unique(cell2mat(S)));

その他の回答 (0 件)

カテゴリ

製品

質問済み:

2019 年 11 月 11 日

編集済み:

2019 年 11 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by