Effacer les filtres
Effacer les filtres

How to find unique lines in cell arrays

1 vue (au cours des 30 derniers jours)
Artyom
Artyom le 7 Août 2013
How to find unique lines in the next cell array:
15 'm'
18 'm'
15 'm'
So the result will be:
15 'm'
18 'm'

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 7 Août 2013
use unique function
  2 commentaires
Artyom
Artyom le 7 Août 2013
Unique works only with cell array of strings.
Azzi Abdelmalek
Azzi Abdelmalek le 7 Août 2013
a={15 'm'; 18 'm'; 15 'm';13 'r';15 'm'}
b=cellfun(@num2str,a,'un',0)
c=arrayfun(@(x) horzcat(b{x,:}),(1:size(a,1))','un',0)
[idx,idx]=unique(c)
out=a(idx,:)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by