How to make character String

조회 수: 2 (최근 30일)
Neil Bhattacharjee
Neil Bhattacharjee 2016년 8월 1일
편집: Azzi Abdelmalek 2016년 8월 1일
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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 1일
편집: Azzi Abdelmalek 2016년 8월 1일
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개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by