Hi, I have a matrix of dimensions 5 by 7 by 50 e.g. g1 = rand(5,7,50) I have another matrix of indices for the row and column e.g. [1 3; 4 5; etc] Now I would like to index all the pages at those indices:
My attempt albeit slow:
for page = 2:50 lg = sub2ind(size(g1), ind(:,1), ind(:,2), page.*ones(length(ind),1),1)) g1(lg)end
Could someone explain to me how to do the above without for loop. I think I can follow one of the link below to remove the sub2ind. Thx!
In addition to the following I did look at the doc
Best Answer