Main Content

Construct and Work with Object Arrays

Object array construction and concatenation; heterogeneous arrays

Construct object arrays, reference objects and their properties from arrays, and design class hierarchies that support the formation of heterogeneous (mixed class) arrays.

Funktionen

emptyCreate empty array of specified class

Klassen

matlab.mixin.HeterogeneousSuperclass for heterogeneous array formation

Themen

Build Object Arrays

Concatenating Arrays

Object Converters and Class of Arrays

Heterogeneous Arrays

  • 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.