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)
댓글 수: 0
채택된 답변
Image Analyst
2015년 2월 9일
I use John D'Errico's allwords(): http://www.mathworks.com/matlabcentral/fileexchange/27184-allwords
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
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 Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!