coder.CellType Class
Namespace: coder
Superclasses: coder.ArrayType
Represent set of MATLAB cell arrays
Description
Specifies the set of cell arrays that the generated code accepts. Use only with the
codegen
-args
option. Do not pass as an input to a generated MEX
function.
Creation
Note
You can also create and edit coder.Type
objects interactively
by using the Coder Type Editor. See Create and Edit Input Types by Using the Coder Type Editor.
t = coder.typeof(
creates a cells
)coder.CellType
object for a cell array that has the same cells
and cell types as cells
. The cells in cells
are
type objects or example values.
t = coder.typeof(
creates a cells
,sz
,variable_dims
)coder.CellType
object that has upper bounds
specified by sz
and variable dimensions specified by
variable_dims
. If sz
specifies
inf
for a dimension, then the size of the dimension is unbounded and
the dimension is variable size. When sz
is []
, the
upper bounds do not change. If you do not specify the variable_dims
input parameter, except for the unbounded dimensions, the dimensions of the type are fixed.
A scalar variable_dims
applies to the bounded dimensions that are not
1
or 0
.
When cells
specifies a cell array whose elements have different
classes, you cannot use coder.typeof
to create a coder.CellType
object for a variable-size cell array.
t = coder.newtype('cell',
creates a
cells
)coder.CellType
object for a cell array that has the
cells and cell types specified by cells
. The cells in
cells
must be type objects.
t = coder.newtype('cell',
creates a cells
,sz
,variable_dims
)coder.CellType
that has upper bounds specified
by sz
and variable dimensions specified by
variable_dims
. If sz
specifies
inf
for a dimension, then the size of the dimension is unbounded and
the dimension is variable size. When sz
is []
, the
upper bounds do not change. If you do not specify the variable_dims
input parameter, except for the unbounded dimensions, the dimensions of the type are fixed.
A scalar variable_dims
applies to the bounded dimensions that are not
1
or 0
.
When cells
specifies a cell array whose elements have different
classes, you cannot use coder.newtype
to create a coder.CellType
object for a variable-size cell array.
Input Arguments
Properties
Methods
Examples
Tips
In the display of a
coder.CellType
object, the termslocked heterogeneous
orlocked homogeneous
indicate that the classification as homogeneous or heterogeneous is permanent. You cannot later change the classification by using themakeHomogeneous
ormakeHeterogeneous
methods.coder.typeof
determines whether the cell array type is homogeneous or heterogeneous. If the cell array elements have the same class and size,coder.typeof
returns a homogeneous cell array type. If the elements have different classes,coder.typeof
returns 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 a1x2
heterogeneous type. The first element is double and the second element is1x2
double. The type can also be a1x3
homogeneous type in which the elements have classdouble
and size1x:2
. For these ambiguous cases,coder.typeof
uses heuristics to classify the type as homogeneous or heterogeneous. If you want a different classification, use themakeHomogeneous
ormakeHeterogeneous
methods. ThemakeHomogeneous
method makes a homogeneous copy of a type. ThemakeHeterogeneous
method makes a heterogeneous copy of a type.The
makeHomogeneous
andmakeHeterogeneous
methods permanently assign the classification as homogeneous and heterogeneous, respectively. You cannot later use one of these methods to create a copy that has a different classification.Value. To learn how value classes affect copy operations, see Copying Objects.
Version History
Introduced in R2015b