示例
%%
%1维数组
a1_1=[1,2,3,4]
a1_2=[1 2 3 4]
%2维数组a2[][]
a_n=[1 2 3 4;5 6 7 8]
%多维数组,对a2x4数组进行扩展
a_n(:,:,2)=[9 10 11 12;13 14 15 16]
a_n(:,:,3)=[17 18 19 20; 21 22 23 24]
%用与其他数据相同的函数进行创建
b = ones(4,4,2) 
c = randn(2,2,3) 
%获取维数
a1_1_dims=ndims(a1_1)
b_dims=ndims(b)
c_dims=ndims(c)
%数组大小
a1_1_size=size(a1_1)
b_size=size(b)
c_size=size(c)运行结果:
>> shuzu
a1_1 =
     1     2     3     4
a1_2 =
     1     2     3     4
a_n =
     1     2     3     4
     5     6     7     8
a_n(:,:,1) =
     1     2     3     4
     5     6     7     8
a_n(:,:,2) =
     9    10    11    12
    13    14    15    16
a_n(:,:,1) =
     1     2     3     4
     5     6     7     8
a_n(:,:,2) =
     9    10    11    12
    13    14    15    16
a_n(:,:,3) =
    17    18    19    20
    21    22    23    24
b(:,:,1) =
     1     1     1     1
     1     1     1     1
     1     1     1     1
     1     1     1     1
b(:,:,2) =
     1     1     1     1
     1     1     1     1
     1     1     1     1
     1     1     1     1
c(:,:,1) =
   -0.8045    0.8351
    0.6966   -0.2437
c(:,:,2) =
    0.2157   -1.1480
   -1.1658    0.1049
c(:,:,3) =
    0.7223   -0.6669
    2.5855    0.1873
a1_1_dims =
     2
b_dims =
     3
c_dims =
     3
a1_1_size =
     1     4
b_size =
     4     4     2
c_size =
     2     2     3
>> whos
  Name           Size             Bytes  Class     Attributes
  a1_1           1x4                 32  double              
  a1_1_dims      1x1                  8  double              
  a1_1_size      1x2                 16  double              
  a1_2           1x4                 32  double              
  a_n            2x4x3              192  double              
  b              4x4x2              256  double              
  b_dims         1x1                  8  double              
  b_size         1x3                 24  double              
  c              2x2x3               96  double              
  c_dims         1x1                  8  double              
  c_size         1x3                 24  double    








