How can I remove duplicate values from cell array?

10 次查看(过去 30 天)
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
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 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by