How to make character String
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Neil Bhattacharjee
el 1 de Ag. de 2016
Editada: Azzi Abdelmalek
el 1 de Ag. de 2016
Hiya,
If I have a character string that the User Inputed,
for instance
prompt = 'What is the character string ';
str = input(prompt,'s');
And the user inputs something like
the quick brown fox jumps over the lazy dog
I want each individual word to be stored into an array.
I know this is simple and am sorry for my silliness.
How could I go about doing this?
Thanks
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 1 de Ag. de 2016
Editada: Azzi Abdelmalek
el 1 de Ag. de 2016
str='the quick brown fox jumps over the lazy dog'
out=strsplit(str)
strsplit was introduced in R2013a
If your Matlab version is older
str='the quick brown fox jumps over the lazy dog'
out=regexp(str,'\S+','match')
0 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!