Pregunta

In my script I am creating an array, the number of dimensions of which are not known in advance. I want to get a certain sub-matrix from the array. Typically with an array of a known number of dimensions I would just write array(i1, i2, i3, ... iN, :, :). However, the indices are contained in an array I = [i1, i2, i3, ... iN). How do I accomplish this?

¿Fue útil?

Solución

You can convert the index vector to a cell first:

A(num2cell(idx){:})

but there is probably a more elegant solution to that.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top