本文为我使用过程中的一些自我放忘记杂项笔记,不涉及教程,也不成体系
环境
配置编译器
mex 编译配置 在编译sfunction时候使用,这里我使用visual studio
高低版本搭配问题
混合编程
模型开发
标定量制作
标定量制作
示例:
```python
```python
```python
k_LongCtrl_TGFactor_y_s = mpt.Parameter;
k_LongCtrl_TGFactor_y_s.Value = single( ...
[1.6 1.4 0.6 0.6 0.6]);
k_LongCtrl_TGFactor_y_s.CoderInfo.StorageClass = 'Custom';
k_LongCtrl_TGFactor_y_s.CoderInfo.Identifier = '';
k_LongCtrl_TGFactor_y_s.CoderInfo.Alignment = -1;
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomStorageClass = 'Volatile';
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.HeaderFile = '';
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.DefinitionFile = ...
'LongCtrl_CalibParameterAll.c';
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.Owner = '';
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.PreserveDimensions = false;
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.PersistenceLevel = 1;
k_LongCtrl_TGFactor_y_s.Description = '';
k_LongCtrl_TGFactor_y_s.DataType = 'single';
k_LongCtrl_TGFactor_y_s.Min = [];
k_LongCtrl_TGFactor_y_s.Max = [];
k_LongCtrl_TGFactor_y_s.DocUnits = '';
k_LongCtrl_TGFactor_y_s = mpt.Parameter;:
创建一个参数对象,该对象的类型是 mpt.Parameter,并将其赋值给变量 k_LongCtrl_TGFactor_y_s。
k_LongCtrl_TGFactor_y_s.Value = single([1.6 1.4 0.6 0.6 0.6]);:
为参数对象设置值,这里是一个包含五个单精度浮点数的数组。
k_LongCtrl_TGFactor_y_s.CoderInfo.StorageClass = ‘Custom’;:
设置参数对象的代码生成信息,其中 StorageClass 被设置为 ‘Custom’,表示使用自定义存储类。
k_LongCtrl_TGFactor_y_s.CoderInfo.Identifier = ‘’;:
设置代码生成信息中的标识符为空字符串。
k_LongCtrl_TGFactor_y_s.CoderInfo.Alignment = -1;:
设置代码生成信息中的对齐方式为 -1,表示使用默认的对齐方式。
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomStorageClass = ‘Volatile’;:
设置代码生成信息中的自定义存储类为 ‘Volatile’,表示该变量可能会在没有明确告知编译器的情况下被改变,因此编译器不应该进行优化。
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.HeaderFile = ‘’;:
设置代码生成信息中的自定义属性,其中 HeaderFile 被设置为空字符串,表示没有头文件与此存储类相关联。
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.DefinitionFile = ‘LongCtrl_CalibParameterAll.c’;:
设置代码生成信息中的自定义属性,其中 DefinitionFile 被设置为 ‘LongCtrl_CalibParameterAll.c’,表示相关的定义将在名为 ‘LongCtrl_CalibParameterAll.c’ 的C文件中定义。
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.Owner = ‘’;:
设置代码生成信息中的自定义属性,其中 Owner 被设置为空字符串,表示没有特定的所有者。
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.PreserveDimensions = false;:
设置代码生成信息中的自定义属性,其中 PreserveDimensions 被设置为 false,表示不保留数组的维度信息。
k_LongCtrl_TGFactor_y_s.CoderInfo.CustomAttributes.PersistenceLevel = 1;:
设置代码生成信息中的自定义属性,其中 PersistenceLevel 被设置为 1,表示变量的持久性级别为1。
k_LongCtrl_TGFactor_y_s.Description = ‘’;:
设置参数的描述信息为空字符串。
k_LongCtrl_TGFactor_y_s.DataType = ‘single’;:
设置参数的数据类型为单精度浮点数。
k_LongCtrl_TGFactor_y_s.Min = [];:
设置参数的最小值为空数组,表示没有明确指定的最小值。
k_LongCtrl_TGFactor_y_s.Max = [];:
设置参数的最大值为空数组,表示没有明确指定的最大值。
k_LongCtrl_TGFactor_y_s.DocUnits = ‘’;:
设置参数的文档单位为空字符串,表示没有指定文档单位。