필터 지우기
필터 지우기

Indexing result of strsplit('My string', ' ')

조회 수: 37 (최근 30일)
Nicolas Bourbaki
Nicolas Bourbaki 2018년 6월 20일
댓글: Nicolas Bourbaki 2018년 7월 24일
Why doesn't something like
strsplit('My string', ' ')(1)
work?
Is there a more elegant way than
x = strsplit('My string', ' ')
x(1)

채택된 답변

Guillaume
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}
  댓글 수: 1
Nicolas Bourbaki
Nicolas Bourbaki 2018년 7월 24일
Thanks a lot for your answer. It helps me a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by