Actually, it is even better. Apparently I can use num2cell to index
multidimensional matrices directly (instead of using a vector +
sub2ind), like this:
N = [3 3 4];
A = zeros(N);
idx = [1 3 2];
iidx = num2cell(idx);
A( iidx{:} ) = 1;
Therefore, you can just wrap it up in a single line:
A(num2cell([1 2 3]){:})=2