Main Content

本页的翻译已过时。点击此处可查看最新英文版本。

对象数组

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

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

函数

empty创建指定类的空数组

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

主题

构建对象数组

构造对象数组

在构造函数中构建对象数组,并将数组以输出参数形式返回。

初始化对象数组

MATLAB® 不带参数调用类构造函数,用默认对象初始化数组元素。

Initialize Arrays of Handle Objects

MATLAB uses a default object to initialize the empty elements of an array of handle objects.

空数组

空数组没有元素,但属于某个类。

Accessing Dynamic Properties in Arrays

Access dynamic properties in object arrays by referring to individual objects.

串联数组

Concatenation Methods

You can concatenate objects into arrays.

Concatenating Objects of Different Classes

MATLAB follows specific rules when you attempt to create an array with objects of different classes.

对象转换器和数组类

Implicit Class Conversion

MATLAB attempts to convert elements to the class of the array as a result of concatenation or assignment.

Object Converters

You can convert an object of one class to an object of another class.

Determine Array Class

You can determine the class of an array.

异构数组

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.