我想在rtw build期间从PostCodeGenCommand
调用的函数中获取已编译端口数据类型的列表。 get_param(outportlist,'CompiledPortDataTypes')
is返回空单元格数组,就像模型没有编译一样。如果我将命令Model([],[],[],'compile');
放入脚本中,我会收到有关递归函数调用的错误。
是否有编译模型的句柄,我应该传递给我的PostCodeGenCommand?
代替
Model([],[],[], 'compile')
使用以下代码对我有用:
get_param('f14', 'SimulationStatus')
set_param('f14', 'SimulationCommand', 'start')
set_param('f14', 'SimulationCommand', 'pause')
portdata = get(gcbh, 'CompiledPortDataTypes')
set_param('f14', 'SimulationCommand', 'stop')
正如您所看到的,我在f14演示模型上进行了测试。它更像是一个黑客,但如果模型没有复杂的初始化程序,这很好。