Dynamic slicing of Matlab array
I have an n-dimensional array A and want to slice it dynamically, i.e., given a list of array dimensions, like [2 4], and a list of values, like [6 8], I want B = A(:,6,:,8,:,:,:,:,...) List lengths are unknown. Using eval would work but is not an option. This question is a generalization of a previous post to multiple indices and dimensions without a for-loop. rayryeng You can still use the previous post I linked to (which I originally flagged as a duplicate) to answer your question . This original post only slices in one dimension. I originally flagged it as a duplicate and closed it because