フィルターのクリア

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 Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by