摘自于:https://zhidao.baidu.com/question/1987862234171281467.html
https://www.zybang.com/question/dcb09bdcf46814700a9d4ae4f1d130a5.html
mat2cell:是指把元胞数组变换成数值型矩阵;
参考用法如下:>> C={[1 2] [2];[2 3] [4];[5 6] [7]};>> C
C =
[1x2 double] [2]
[1x2 double] [4]
[1x2 double] [7]
>> cell2mat(C)
ans =
1 2 2
2 3 4
5 6 7
num2cell:num2cell的作用是把数值数组转换为cell数组.
最基本的用法是把数值数组的每个元素作为cell数组的元素,得到一个和原数组维度完全相同的cell数组,例如
>> A=magic(3)
A =
8 1 6
3 5 7
4 9 2
>> c=num2cell(A)
c =
[8] [1] [6]
[3] [5] [7]
[4] [9] [2]