0

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

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

4

1 回答 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 演示模型上对此进行了测试。这更像是一种 hack,但如果模型没有复杂的初始化过程,这可以正常工作。

于 2017-12-21T14:55:24.503 回答