Nesting depth and the error "Expected one output from a curly brace or dot indexing expression, but there were x results."
5 views (last 30 days)
Consider this toy example:
Why does this produce the infamous error
Expected one output from a curly brace or dot indexing expression, but there were 2 results.
..instead of just listing all values from across all indexed structure elements, as in this other example where the nesting is at level 2 instead of level 3:
More Answers (1)
Jan on 19 Aug 2022
R2022a creates a different error:
"instead of just listing all values from across all indexed structure elements"
Think twice. [a.x] is an array already with 2 elements. The dot operator cannot handle an array as input, but a scalar struct only. This is plausible. Consider, that there is no logical decision for the dimensions of the output. It is also unclear, what you call "just listing all values".