how to split a string by whitespace

3 次查看(过去 30 天)
hi,how to split a string to array splitted by whitespace,also how to convert a date to string ( matlab R2008a)

采纳的回答

Image Analyst
Image Analyst 2015-2-9
s = 'hi,how to split a string to array splitted by whitespace,also how to convert a date to string ( matlab R2008a)'
theWords = allwords(s)
Result:
theWords =
Columns 1 through 14
'hi' 'how' 'to' 'split' 'a' 'string' 'to' 'array' 'splitted' 'by' 'whitespace' 'also' 'how' 'to'
Columns 15 through 22
'convert' 'a' 'date' 'to' 'string' '(' 'matlab' 'R2008a)'
You can specify delimiters other than spaces if you wish.
  2 个评论
ben zekri raouf
ben zekri raouf 2015-2-9
thnx so much ,but unfortunately the function ''allwords'' does not exist in matlab 2008a,i tried it but it didn't work :( ??? Undefined function or method 'allwords' for input arguments of type 'char'.
John D'Errico
John D'Errico 2015-2-9
Sure it does. You just need to download it. (It is free too.) Image Analyst gave you the link to find it.
Once you download the file, add the unzipped directory to your search path, and it will now work.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by