How can I repeat a 2-D array to create a 3-D array?
2 views (last 30 days)
A is a 2x3 array. I want to create a 3-D 'stack' so that each layer of the 3-D stack is identical to A. I've found that the following code gives the desired result:
A =[1 2 3;4 5 6];
disp (squeeze(B(3,:,:))) % an example showing that any layer of the 3-D array is the same as A
Is there a more elegant way to do this? I tried using repmat but couldn't get the same result.