可以在命令行或中定义表输入MATLAB®编码器™通过使用预处理来编程说明表的输入类型(断言
语句)不支持。万博1manbetx
使用以下程序之一:
或者,如果您有一个使用示例输入调用入口点函数的测试文件,您可以通过使用coder.getArgTypes
.
使用arg游戏
选择:
T =表(A, B, C,“VariableNames”, vnames);codegenmyFunctionarg游戏{T}
为要指定的表提供类型codegen
:
定义一个表。例如:
T =表(A, B, C,“VariableNames”, vnames);
创建类型T
.
t = coder.typeof (t);
将类型传递给codegen
通过使用arg游戏
选择。
codegenmyFunctionarg游戏{t}
若要指定表输入为常量,请使用编码器。常数
与arg游戏
选择:
T =表(A, B, C,“VariableNames”, vnames);codegenmyFunctionarg游戏{coder.Constant (T)}
使用以下程序之一:
表的编码器类型对象描述对象及其属性。使用coder.typeof
或通过表格
作为字符串标量coder.newtype
.
编码器类型对象显示对象属性的简洁描述,同时排除内部状态值。非常量属性显示它们的类型和大小,而常量属性只显示它们的值。例如:
A = [1 2 3]';B = [4 5 6]';C = [7 8 9]';t =表(A, B, C);式= coder.typeof (t)
变量的表示t
是否存储在编码器类型对象中式
.
式= matlab.coder.type.TableType 3 x3表数据:1 x3均匀单元描述:1 x0 char用户数据:0 x0双重DimensionNames:{“行”}{}“变量”VariableNames: {A} {B} {' C '} VariableDescriptions: 1 x3均匀细胞VariableUnits: 1 x3均匀细胞VariableContinuity: 1 x3 matlab.internal.coder.tabular.Continuity RowNames:0 x0均匀的细胞
如果您的工作流需要编码器类型对象的遗留表示形式,请使用getCoderType
函数调用具有类或对象新表示形式的变量。看到编码器类型对象的遗留表示.
coder.resize
您可以使用coder.resize
.您可以调整对象的大小,它的属性,并在属性中创建数组。
对于一个表格
Coder对象,你可以调整对象属性的大小:
A = [1 2 3]';B = [4 5 6]';C = [7 8 9]';t =表(A, B, C);tType = code .typeof(t)描述= coder.resize(tType.Description,[1 12],[0 1])
此代码调整描述
属性为1 x: 12
字符
性质的上界是12
.
tType = matlab.code .type. tabletype 3x3 table Data: 1x3 homogeneous cell Description: 1x:12 char UserData: 0x0 double DimensionNames: {'Row'} {'Variables'} VariableNames: {'A'} {'B'} {'C'} VariableDescriptions: 1x3 homogeneous cell VariableUnits: 1x3 homogeneous cell variabcontinuity:1x3 matlab.internal.code .tabular. continuity RowNames: 0x0同质单元格
您还可以使用coder.resize
.看到编辑和表示编码器类型对象和属性.