MATLAB 的 cell 大法(单元格数组)

MATLAB 的 cell,称单元格数组 or 元胞数组:使用频率特别高,甚至比 struct 结构体还高。

MATLAB文档给出的 cell 官方定义:

  A cell array is a collection of containers called cells in which you can store different types of data.

  精华之处就是在可以存储不同类型的数据.可以是Matlab的类型或者自定义的类型.

  一个元胞数组的一个单元可能包含:一个实数数组 or 字符型数组 or 复数数组 or 元胞数组(嵌套啦)

1  元胞数组的创建

  创建方法有 3 种:直接赋值法、利用函数cell()、利用{ }直接创建元胞数组的所有单元。

  1.1 直接赋值法

  1.2 利用函数cell() ——较为常用

  1.3 利用{ }直接创建元胞数组的所有单元

2  元胞数组的寻访

【Reference】

1、http://blog.sina.com.cn/s/blog_8259d70901017wit.html

2、

猜你喜欢

转载自www.cnblogs.com/shenxiaolin/p/9281637.html
今日推荐