Create a coder.Type
object to represent the type of an
entry-point function input
The coder.newtype
function is an advanced function that
you can use to control the coder.Type
object. Consider
using coder.typeof
instead of
coder.newtype
. The function coder.typeof
creates a type from a MATLAB® example.
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.
creates a t
= coder.newtype(numeric_class
,sz
,variable_dims
)coder.Type
object representing values of
class numeric_class
, sizes sz
(upper bound),
and variable dimensions variable_dims
. If sz
specifies inf
for a dimension, then the size of the dimension is
unbounded and the dimension is variable-size. When variable_dims
is not specified, the dimensions of the type are fixed except for those that are
unbounded. When variable_dims
is a scalar, it is applied to type
dimensions that are not 1
or 0
, which are
fixed.
creates a t
= coder.newtype(numeric_class
,sz
,variable_dims
,
Name,Value
)coder.Type
object by using additional
options specified as one or more Name, Value pair arguments.
creates a t
= coder.newtype('struct',struct_fields
,sz
,variable_dims
)coder.StructType
object for an array of
structures that has the same fields as the scalar structure
struct_fields
. The structure array type has the size
specified by sz
and variable-size dimensions specified by
variable_dims
.
creates a t
= coder.newtype('cell',cells
,sz
,variable_dims
)coder.CellType
object for a cell array
that has the cells and cell types specified by cells
. The cell
array type has the size specified by sz
and variable-size
dimensions specified by variable_dims
. You cannot change the
number of cells or specify variable-size dimensions for a heterogeneous cell
array.
creates a t
= coder.newtype('embedded.fi',numerictype,sz
,variable_dims
,
Name,Value
)coder.FiType
object representing a set
of fixed-point values that have numerictype
and additional
options specified by one or more Name, Value pair arguments.
creates a t
= coder.newtype(enum_value
,sz
,variable_dims
)coder.Type
object representing a set of
enumeration values of class enum_value
.
creates a t
= coder.newtype(class_name
)coder.ClassType
object for an object of
the class class_name
.
creates a
type for a string scalar. A string scalar contains one piece of text represented as
a character vector. To specify the size of the character vector and whether the
second dimension is variable-size, create a type for the character vector and assign
it to the t
= coder.newtype('string')Value
property of the string scalar type. For example,
t.Properties.Value = coder.newtype('char',[1 10],[0 1])
specifies that the character vector inside the string scalar is variable-size with
an upper bound of 10.
For sparse matrices, coder.newtype
drops upper bounds for
variable-size dimensions.
For GPU input types, only bounded numeric and logical base types are supported. Scalar GPU arrays, structures, cell-arrays, classes, enumerated types, character, half-precision and fixed-point data types are not supported.
When using coder.newtype
to represent GPU inputs, the
memory allocation (malloc) mode property of the GPU code configuration object
must be set to 'discrete'
.
The coder.newtype
function fixes the size of a singleton
dimension unless the variable_dims
argument explicitly
specifies that the singleton dimension has a variable-size.
For example, the following code specifies a 1-by-:10 double. The first dimension (the singleton dimension) has a fixed size. The second dimension has a variable-size.
t = coder.newtype('double',[1 10],1)
t = coder.newtype('double',[1 10],[1 1])
For a MATLAB Function block, singleton dimensions of input or output signals cannot have a variable-size.
coder.ArrayType
| coder.CellType
| coder.EnumType
| coder.FiType
| coder.PrimitiveType
| coder.resize
| coder.StructType
| coder.Type
| fiaccel