I would like to do the following syntax in 1 line:
lst = {dir('*.jpg')};lst{1}.name
I tried:
{dir('*.jpg')}{1}.name
However, MATLAB shows me the error message:
{dir('*.jpg')}{1}.name ↑ Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
Is there a workaround to do the indexing in 1 line?
Best Answer