Indexing result of strsplit('My string', ' ')
31 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nicolas Bourbaki
am 20 Jun. 2018
Kommentiert: Nicolas Bourbaki
am 24 Jul. 2018
Why doesn't something like
strsplit('My string', ' ')(1)
work?
Is there a more elegant way than
x = strsplit('My string', ' ')
x(1)
0 Kommentare
Akzeptierte Antwort
Guillaume
am 20 Jun. 2018
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}
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!