makeHomogeneous
Class: coder.CellType
Namespace: coder
Create a homogeneous copy of a cell array type
Syntax
newt = makeHomogeneous(t)
t = makeHomogeneous(t)
Description
creates
a newt = makeHomogeneous(t)coder.CellType object for a homogeneous cell array newt from
the coder.CellType object t.
To create newt, the makeHomogeneous method
must determine a size and class that represent all
elements of t:
If the elements of
thave the same class, but different sizes, the elements ofnewtare variable size with upper bounds that accommodate the elements oft.If the elements of
thave different classes, for example,charanddouble, themakeHomogeneousmethod cannot create acoder.CellTypeobject for a homogeneous cell array.
If you use coder.cstructname to specify a name for
the structure type that represents t in the generated code, you cannot
create a homogeneous coder.CellType object from
t.
The classification as homogeneous is permanent. You cannot later
create a heterogeneous coder.CellType object from newt.
creates
a homogeneous t = makeHomogeneous(t)coder.CellType object from t and
replaces t with the new object.
Examples
Tips
In the display of a
coder.CellTypeobject, the termslocked heterogeneousorlocked homogeneousindicate that the classification as homogeneous or heterogeneous is permanent. You cannot later change the classification by using themakeHomogeneousormakeHeterogeneousmethods.coder.typeofdetermines whether the cell array type is homogeneous or heterogeneous. If the cell array elements have the same class and size,coder.typeofreturns a homogeneous cell array type. If the elements have different classes,coder.typeofreturns a heterogeneous cell array type. For some cell arrays, the classification as homogeneous or heterogeneous is ambiguous. For example, the type for {1 [2 3]} can be a 1x2 heterogeneous type. The first element is double and the second element is 1x2 double. The type can also be a 1x3 homogeneous type in which the elements have class double and size 1x:2. For these ambiguous cases,coder.typeofuses heuristics to classify the type as homogeneous or heterogeneous. If you want a different classification, use themakeHomogeneousormakeHeterogeneousmethods.
Version History
Introduced in R2015b