cell array to string array
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ido Gross
el 2 de Abr. de 2020
Comentada: simon xi
el 8 de Jul. de 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
Respuesta aceptada
Ameer Hamza
el 2 de Abr. de 2020
Editada: Ameer Hamza
el 2 de Abr. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!