How can I remove duplicate values from cell array?

18 Ansichten (letzte 30 Tage)
Mira le
Mira le am 11 Nov. 2019
Bearbeitet: Nicolas B. am 11 Nov. 2019
I have this problem
S={ 1 2, 2 3 }
how delete duplicate value:
S becomes {1 2 3 }

Akzeptierte Antwort

Nicolas B.
Nicolas B. am 11 Nov. 2019
Bearbeitet: Nicolas B. am 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)));

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by