Is there any short way to stack d outputs of ndgrid(x1,..,xd) into a d+1-dimensional array without using workarounds like cycles
cgrid=cell(1,d);
[cgrid{:}]=ndgrid(x1, x2, ... , xd);
agrid=zeros([d, size(cgrid{1})]);
for jj=1:d
agrid(jj,:)=reshape(cgrid{jj},size(agrid(jj,:)));
end
or agrid=reshape(cell2mat(cellfun(@(c) c{:},cgrid)),[d, size(cgrid{1})])?
It seems to me that even simple operations with multidimensional arrays require lots of low-level commands.