MATLAB Answers

0

How can I remove duplicate values from cell array?

Asked by Mira le on 11 Nov 2019
Latest activity Edited by 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.

1 Answer

Answer by Nicolas B.
on 11 Nov 2019
Edited by Nicolas B.
on 11 Nov 2019
 Accepted Answer

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.