Indexing result of strsplit('My string', ' ')
조회 수: 27 (최근 30일)
이전 댓글 표시
Why doesn't something like
strsplit('My string', ' ')(1)
work?
Is there a more elegant way than
x = strsplit('My string', ' ')
x(1)
댓글 수: 0
채택된 답변
Guillaume
2018년 6월 20일
No matlab does not allow indexing directly into the return value of a function (or any other temporary variable). There is not workaround other than assigning the temporary to a variable, as you have done.
Note that if you want the content of the first element of the cell array {} would be more appropriate
x = strsplit('My string', ' ')
x{1}
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!