定义输入时间表
您可以定义输入的命令行或时间表MATLAB®编码器™时间表的输入类型的应用程序。编程规范使用预处理(断言
不支持语句)。金宝app
在命令行输入定义时间表
使用其中的一个过程:
另外,如果你有一个测试文件,输入你的入口点函数的例子,您可以确定使用的输入类型coder.getArgTypes
。
提供一个示例输入时间表
使用arg游戏
选择:
TT =时间表(A, B, C,“RowTimes”D“VariableNames”,vnames);codegenmyFunctionarg游戏{TT}
提供一个时间表类型
提供一个类型一个时间表codegen
:
定义一个时间表。例如:
TT =时间表(A, B, C,“RowTimes”D“VariableNames”,vnames);
创建一个类型
T
。t = coder.typeof (TT);
通过类型
codegen
通过使用arg游戏
选择。codegenmyFunctionarg游戏{t}
提供一个常数输入时间表
指定一个时间表的输入是常数,使用coder.Constant
与arg游戏
选择:
TT =时间表(A, B, C,“RowTimes”D“VariableNames”,vnames);codegenmyFunctionarg游戏{coder.Constant (TT)}
定义输入的时间表MATLAB编码器应用程序
使用其中的一个过程:
表示的时间表
一个编码器类型对象的时间表描述对象及其属性。使用coder.typeof
或通过时间表
作为一个字符串标量coder.newtype
。
编码器类型对象显示一个简洁的描述对象属性而不包括内部状态值。非常数的属性显示他们的类型和大小,而不变的属性只显示它们的值。例如:
t =时间表((1:5),(15),“SampleRate”1);式= coder.typeof (t)
的代表性变量t
存储在编码器类型对象式
。
式= matlab.coder.type。RegularTimetableType 5 x2时间表数据:1 x2均匀单元描述:1 x0 char用户数据:0 x0双重DimensionNames:{‘时间’}{}“变量”VariableNames: {“Var1”} {‘Var2} VariableDescriptions: 1 x2均匀细胞VariableUnits: 1 x2均匀细胞VariableContinuity: 1 x2 matlab.internal.coder.tabular.Continuity开始时间:1 x1 matlab.coder.type。DurationType SampleRate: 1 x1双重步伐:1 x1 matlab.coder.type.DurationType
定义一个规则时间表
通过指定SampleRate
或步伐
。您还可以定义一个不规则的时间表
通过指定RowTimes
。例如:
t1 =时间表((1:3)”,“RowTimes”秒(1:3));t1Type = coder.typeof (t)
不规则的表的表示t1
存储在编码器类型对象t1Type
。
t1Type = matlab.coder.type。TimetableType 3x1 timetable Data : 1x1 homogeneous cell Description : 1x0 char UserData : 0x0 double DimensionNames : {'Time'} {'Variables'} VariableNames : {'Var1'} VariableDescriptions : 1x1 homogeneous cell VariableUnits : 1x1 homogeneous cell VariableContinuity : 1x1 matlab.internal.coder.tabular.Continuity RowTimes : 3x1 matlab.coder.type.DurationType
如果你的工作流程需要编码器的遗产表示类型对象,使用getCoderType
函数的变量的新代表类或对象。看到遗留的编码器类型对象。
通过调整对象属性coder.resize
您可以调整大多数对象使用coder.resize
。您可以调整对象,其属性在属性和创建数组。
对于一个时间表
编码器对象,您可以调整对象属性:
t =时间表((1:5),(15),“SampleRate”1);式= coder.typeof (t);式。使用rData = coder.resize(tType.UserData,[10 1],[1 0])
这段代码修改尺寸用户数据
房地产是一个:10 x1
双
财产。第一个维度是上限10
。
式= matlab.coder.type。RegularTimetableType 5 x2时间表数据:1 x2均匀单元描述:1 x0 char用户数据::10 x1双重DimensionNames:{‘时间’}{}“变量”VariableNames: {“Var1”} {‘Var2} VariableDescriptions: 1 x2均匀细胞VariableUnits: 1 x2均匀细胞VariableContinuity: 1 x2 matlab.internal.coder.tabular.Continuity开始时间:1 x1 matlab.coder.type。DurationType SampleRate: 1 x1双重步伐:1 x1 matlab.coder.type.DurationType
您还可以调整对象使用coder.resize
。看到编辑和代表编码器类型对象和属性。
另请参阅
时间表
|coder.Constant
|coder.typeof