Ok, this is my code. Any improvement/correction will be welcomed.
si = size(T);
nd = ndims(T);
ix = cell(nd,1);
for d = 1:nd
ix{d} = 1:si(d);
end
A = zeros(si+1);
A(ix{:}) = T;
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!