Main Content


C++ class to access MATLAB object arrays


Use ObjectArray objects to access MATLAB® object arrays. To create an ObjectArray, call createArray in the ArrayFactory class using this syntax:

template <typename ItType, typename T>
TypedArray<T> createArray(ArrayDimensions dims, 
    ItType begin, 
    ItType end)

To create a scalar object, call createScalar using this syntax:

ObjectArray createScalar(const Object& val);

ObjectArray is defined as:

using ObjectArray = TypedArray<Object>;

Class Details





You cannot combine elements of an ObjectArray into a heterogeneous array.

If the class defining the Object overrides subsref or subsasgn, then you cannot access the elements of the ObjectArray.

Objects in MEX and Engine Applications

C++ MEX and C++ Engine applications can get and set property values on MATLAB objects. For information on how to access MATLAB objects in these applications, see these topics:

Version History

Introduced in R2017b