Simulink从PostCodeGenCommand中获取CompiledPortDataTypes

问题描述 投票:0回答:1

我想在rtw build期间从PostCodeGenCommand调用的函数中获取已编译端口数据类型的列表。 get_param(outportlist,'CompiledPortDataTypes')is返回空单元格数组,就像模型没有编译一样。如果我将命令Model([],[],[],'compile');放入脚本中,我会收到有关递归函数调用的错误。

是否有编译模型的句柄,我应该传递给我的PostCodeGenCommand?

matlab compilation simulink rtw
1个回答
0
投票

代替

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演示模型上进行了测试。它更像是一个黑客,但如果模型没有复杂的初始化程序,这很好。

© www.soinside.com 2019 - 2024. All rights reserved.