| Contents | Index |
Create a new coder.Type object
t=coder.newtype(numeric_class, sz, variable_dims)
t=coder.newtype(numeric_class, sz, variable_dims,
Name, Value)
t=coder.newtype('constant', value)
t=coder.newtype('struct', struct_fields, sz, variable_dims)
t=coder.newtype('embedded.fi',
numerictype, sz, variable_dims,
Name, Value)
t=coder.newtype(enum_value, sz, variable_dims)
Note coder.newtype is an advanced function. Consider using coder.typeof instead. |
t=coder.newtype(numeric_class, sz, variable_dims) creates a coder.Type object representing values of class numeric_class with (upper bound) sizes sz 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, all the dimensions of the type are fixed except for those that are unbounded. When variable_dims is a scalar, it is applied to all the dimensions of the type, except if the dimension is 1 or 0, which is always fixed.
t=coder.newtype(numeric_class, sz, variable_dims, Name, Value) creates a coder.Type object with additional options specified by one or more Name, Value pair arguments.
t=coder.newtype('constant', value) creates a coder.Constant object representing a single value. Use this type to specify a value that should be treated as a constant in the generated code.
t=coder.newtype('struct', struct_fields, sz, variable_dims) creates a coder.StructType object for an array of structures of the given sz and variable_dims information with the same fields as the scalar structure struct_fields.
t=coder.newtype('embedded.fi', numerictype, sz, variable_dims, Name, Value) creates a coder.FiType object representing a set of fixed-point values with numerictype and additional options specified by one or more Name, Value pair arguments.
t=coder.newtype(enum_value, sz, variable_dims) creates a coder.Type object representing a set of enumeration values of class enum_value.
Specify optional comma-separated pairs of Name,Value arguments, where Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
t |
New coder.Type object. |
Create a new type for use in code generation.
t=coder.newtype('double',[2 3 4],[1 1 0])
% Returns double :2x:3x4
% ':' indicates variable-size dimensionsCreate a type for a matrix of doubles, first dimension unbounded, second dimension with fixed size
coder.newtype('double',[inf,3])
% returns double:inf x 3
coder.newtype('double', [inf, 3], [1 0])
% also returns double :inf x3
% ':' indicates variable-size dimensionsCreate a type for a matrix of doubles, first dimension unbounded, second dimension with variable size with an upper bound of 3
coder.newtype('double', [inf,3],[0 1])
% returns double :inf x :3
% ':' indicates variable-size dimensionsCreate a new structure type for use in code generation.
ta = coder.newtype('int8',[1 1]);
tb = coder.newtype('double',[1 2],[1 1]);
coder.newtype('struct',struct('a',ta,'b',tb))
% returns struct 1x1
% a: int8 1x1
% b: double :1x:2
% ':' indicates variable-size dimensionsCreate a new constant type for use in code generation.
k = coder.newtype('constant', 42);
% Returns
% k =
%
% coder.Constant
% 42Create a coder.EnumType object using the name of an existing MATLAB enumeration.
Define an enumeration MyColors. On the MATLAB path, create a file named 'MyColors' containing:
classdef(Enumeration) MyColors < int32
enumeration
green(1),
red(2),
end
end
Create a coder.EnumType object from this enumeration.
t = coder.newtype('MyColors');
Create a new fixed-point type for use in code generation. The fixed-point type uses default fimath values.
t = coder.newtype('embedded.fi',...
numerictype(1, 16, 15), [1 2])
t =
% Returns
% coder.FiType
% 1x2 embedded.fi
% DataTypeMode: Fixed-point: binary point scaling
% Signedness: Signed
% WordLength: 16
% FractionLength: 15coder.ArrayType | coder.EnumType | coder.FiType | coder.PrimitiveType | coder.resize | coder.StructType | coder.Type | fiaccel

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |