Indexing arrays of varying dimensionality.
1 view (last 30 days)
I have to handle arrays of varying dimensionality in one loop, and I have to index individual elements of those arrays.
From what I have seen in the general help, the only solution seems to be to do a stupid and unflexible switch-case-like approach, such as
This makes it impossible to handle arrays of arbitrary dimensionality and is also very stupid and repetitive.
Using linear indices doesn't seem to help, because also sub2ind() needs different calls for each dimensionality.
Is there not an easier solution. like