Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

构造和使用对象数组

对象数组的构造和串联;异构数组

构造对象数组、从数组引用对象及其属性,以及设计支持异构(混合类)数组的构造的类层次结构。

函数

empty创建指定类的空数组

matlab.mixin.Heterogeneous异构数组构造的超类

主题

构建和访问对象数组

串联数组

类转换

  • Implicit Class Conversion
    MATLAB can implicitly convert objects to a different class for concatenation, subscripted assignment, property validation, and argument validation.
  • Object Converters
    You can convert an object of one class to an object of another class.

异构数组

  • Designing Heterogeneous Class Hierarchies
    Heterogeneous arrays can contain objects of different class, but all objects in the array must derive from a common superclass.
  • Heterogeneous Array Constructors
    The class of a heterogeneous object array can change as you add array elements of different classes. You must ensure that constructors return objects that are the same class as the class defining the constructor.