MATLAB: Assigning numbers to 3d matrix.

3d matricesmatricesmatrixvector

How can I assign numbers the following matrices?
table (:,:,1) =
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15
table (:,:,2)=
16 21 26
17 22 27
18 23 28
19 24 29
20 25 30

Best Answer

t = reshape(1:30,5,3,2)
or
t = nan(5,3,2);
t(:) = 1:30
or
t = [1;2;3;4;5]+[0,5,10]+reshape([0,15],1,1,[])