I have an indexing problem in Matlab. Let's say that I have a array $A$ with $m$-dimensions with $m$ depending on the problem. So $A \in \mathbb{R}^{n_1 \times ... \times n_m}$
Suppose I have vector with indices $x = [i_2, ..., i_m]$ and I want to take the vector $A(:, i_2, ..., i_m)$. If $m$ is constant in all cases, it is not that difficult. You can just say $i_j = x(j), \forall j = 2, ..., m$. Is it possible to do this without an if-loop (so without saying 'if m == 2 then .. if m == 3 then ...' and so on ?
Thanks for the help
I suggest the following: