cell array to string array
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ido Gross
am 2 Apr. 2020
Kommentiert: simon xi
am 8 Jul. 2023
Hi
I have a cell array consisting of strings. I would like to convert it to an array with one word in each cell.
for example, the cell array: "Hello B
Hi A
Where is D?
and I need: Hello
B
Hi etc.
TIA
Akzeptierte Antwort
Ameer Hamza
am 2 Apr. 2020
Bearbeitet: Ameer Hamza
am 2 Apr. 2020
Something like this
A = {'Hello B Hi A Where is D?'};
B = strsplit(A{:}, ' ')';
Result:
B =
7×1 cell array
{'Hello'}
{'B' }
{'Hi' }
{'A' }
{'Where'}
{'is' }
{'D?' }
6 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!