y、z是元胞数组,num2cell完成由数值数组到元胞数组的转换
>> x=[12 33 22;55 22 44]
x =
12 33 22
55 22 44
>> y=num2cell(x)
y =
[12] [33] [22]
[55] [22] [44]
>> y
y =
[12] [33] [22]
[55] [22] [44]
>> y{1}
ans =
12
>> z=num2cell(x,2)
z =
[1x3 double]
[1x3 double]
>> z{1}
ans =
12 33 22
cell2mat完成由元胞数组到数值数组
>> cell2mat(z)
ans =
12 33 22
55 22 44
>> z{1}
ans =
12 33 22
>> z{1}(1)
ans =
12
>>