ans =
ClassA
If the array includes an object of the class SpecificC, the class of a2 is
RootSuperclass:
a2 = [SpecificA,SpecificB,SpecificC];
class(a2)
ans =
RootSuperclass
If you assigned an object of the class SpecificC to array a1 using indexing, the class of
a1 becomes RootSuperclass:
a1(3) = SpecificC;
class(a1)
ans =
RootSuperclass
If the array contains objects of only one class, then the array is not heterogeneous. For
example, the class of a is SpecificA.
a = [SpecificA,SpecificA];
class(a)
ans =
SpecificA
Property Access
Access array properties with dot notation when the class of the array defines the
properties. The class of the array is the most specific common superclass, which ensures
all objects inherit the same properties.
For example, suppose ClassA defines a property called Prop1.
a1 = [SpecificA,SpecificB];
a1.Prop1
10 Object Arrays