MATLAB Answers

How can I remove duplicate values from cell array?

98 views (last 30 days)
Mira le
Mira le on 11 Nov 2019
Edited: Nicolas B. on 11 Nov 2019
I have this problem
S={ 1 2, 2 3 }
how delete duplicate value:
S becomes {1 2 3 }

  0 Comments

Sign in to comment.

Accepted Answer

Nicolas B.
Nicolas B. on 11 Nov 2019
Edited: Nicolas B. on 11 Nov 2019
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 Comments

Sign in to comment.

More Answers (0)