Remove cells that contain only two or one character
Ältere Kommentare anzeigen
I have a variable that contain large cell arrays of strings but some of the cells contains strings that are meaningless such asç
xx = {'animal','a','aa','bc','dog','car','computer','screen','zx','tt','c','pen','ss'}
I would like to use regexp but I couldnt find appropriate expression to match two or single character.
Any sugguestion is highly appreciated.
Sami
Akzeptierte Antwort
Weitere Antworten (1)
Andrei Bobrov
am 11 Mär. 2014
Bearbeitet: Andrei Bobrov
am 11 Mär. 2014
xx = {'animal','a','aa','bc','dog','car','computer','screen','zx','tt','c','pen','ss'}';
out = xx(cellfun(@numel,xx) <= 2)
:)
out = xx(cellfun(@numel,xx) > 2)
1 Kommentar
KnowledgeSeeker
am 11 Mär. 2014
Bearbeitet: KnowledgeSeeker
am 11 Mär. 2014
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!