I am wondering if it possible to extract data from an array in the same line as the array is created. The purpose is to remove the need for a separate line of code in which the data is extracted.
Example of separate array creation and data extraction:
s = "hello world";t = split(s, " "); % In this line the array "t" is createdt(1) % In this line the first element of "t" is extracted>> ans ="hello"
My question: Can lines 2 and 3 be combined? Something like this:
t = split(s, " ")(1)>> ans ="hello"
Thanks in advance,