Coder.StructTypeclass
Package:编码器
Superclasses:编码器.ArrayType
Represent set ofMATLABstructure arrays
Description
Specifies the set of structure arrays that the generated code should accept. Use only with thecodegen
-args
option. Do not pass as an input to a generated MEX function.
Construction
t=coder.typeof(
creates astruct_v
)Coder.StructType
与标量结构相同字段的结构的对象struct_v
.
t=coder.typeof(
returns a modified copy ofstruct_v
,sz
,variable_dims
)coder.typeof(struct_v)
与(上限)大小指定sz
and variable dimensionsvariable_dims
. Ifsz
specifiesinf
对于一个维度,则假定维度的大小是无限的,并且假定尺寸是可变尺寸的。什么时候sz
is [], the (upper bound) sizes ofstruct_v
remain unchanged. If thevariable_dims
未指定输入参数,假定该类型的尺寸是固定的,除非无界的尺寸。什么时候variable_dims
是标量,将其应用于没有的界限1
或者0
(which are assumed to be fixed).
creates at
= coder.newtype('struct',struct_v
,sz
,variable_dims
)Coder.StructType
具有与标量结构相同字段的一系列结构的对象struct_v
and (upper bound) sizesz
and variable dimensionsvariable_dims
. Ifsz
specifiesinf
对于一个维度,则假定维度的大小是无限的,并且假定尺寸是可变尺寸的。什么时候variable_dims
is not specified, the dimensions of the type are assumed to be fixed except for those that are unbounded. Whenvariable_dims
是标量,它应用于类型的尺寸,除非尺寸为1
或者0
, which is assumed to be fixed.
Input Arguments
|
Scalar structure used to specify the fields in a new structure type. |
|
Size vector specifying each dimension of type object. Default:[1 1] for |
|
Logical vector that specifies whether each dimension is variable size (true) or fixed size (false). Default:false(size(sz))|sz == inf for |
Properties
|
The run-time memory alignment of structures of this type in bytes. If you have an Embedded Coder®license and use Code Replacement Libraries (CRLs), the CRLs provide the ability to align data objects passed into a replacement function to a specified boundary. This capability allows you to take advantage of target-specific function implementations that require data to be aligned. By default, the structure is not aligned on a specific boundary so it will not be matched by CRL functions that require alignment.
|
|
该集合中的值类。 |
|
Whether the structure type is externally defined. |
|
A structure giving the |
|
If the structure type is externally defined, name of the header file that contains the external definition of the structure, for example, By default, the generated code contains Must be a non-empty character vector or string scalar. |
|
该组中的阵列的上限大小。 |
|
用于指定数组的每个维度是固定还是可变大小的向量。如果向量元素是 |
Copy Semantics
价值。要了解价值类别如何影响复制操作,请参见Copying Objects(MATLAB)。
Examples
Create a type for a structure with a variable-size field.
X.A = coder.typeof(0,[3 5],1);X.B =魔术(3);coder.typeof(x)%返回%coder.structtype%1x1 struct%a :: 3x:5 double%b:3x3 double%':'指示变量尺寸尺寸
Create aCoder.StructType
对象然后致电codegen
to generate a C library for a functionfcn.m
这有一个输入ut parameter of this type
Create a new structure type.
ta = coder.newtype('int8',[1 1]);tb = coder.newtype('double',[1 2],[1 1]);z = coder.newtype('struct',struct('a',ta,'b',tb))%返回%coder.structtype%1x1 struct%a:1x1 int8%b :: 1x:2 double
Call
codegen
为MATLAB函数生成C库fcn.m
这有一个输入ut parameter of this type.% Use the -config:lib option to generate a C library codegen -config:lib fcn -args {z}
Create aCoder.StructType
object that uses an externally-defined structure type.
Create a type that uses an externally-defined structure type.
s.a = coder.typeof(double(0));s.b = coder.typeof(单(0));t = coder.typeof(s);t = coder.cstructname(t,'我的风格',“外部”,'HeaderFile','myheader.h');
T = coder.StructType 1x1 extern mytype (myheader.h) struct a: 1x1 double b: 1x1 single
View the types of the structure fields.
T.Fields
ans = a: [1x1 coder.PrimitiveType] b: [1x1 coder.PrimitiveType]
See Also
codegen
|编码器
|编码器.ArrayType
|编码器.ClassType
|编码器.Constant
|编码器.EnumType
|编码器.FiType
|Coder.primitiveType
|coder.type
|Coder.cstructname
|编码器
|编码器.resize
|coder.typeof