I have a matlab matrix full of indices (indx) which can be N rows and D columns (and varies from execution to execution). I also have an output array of D dimensions, output(D1,D2,..,D_D). For a given indx, for example if D=3, a row of indx might equal (1, 2, 3), and I'd like to index output(1,2,3)=k.
However, I am not sure of two things.
1. I don't know D beforehand, how can I access a D length set of indices in output?
2. If so, is there any way accessing all ordered n-tuples in indx for each of their associated entry in output?
For 1, a remark here seems relevant: mathworks tip, specifically the part about "Indexing into an N-D array with N subscripts without knowing N ahead of time (see fftshift for an example)", except a) I'm indexing into an ND array without knowing D, and b) looking at fftshift did not help.
To be completely clear, here's some code illustrating the problem
qq(:,:,1)=[1 2; 3 4];
qq(:,:,2)=[5 6; 7 8];
indx=[1 1 1; 2 2 2]
Thanks for looking at my question.
Edit* Sorry about qq missing the '8'.