我正在尝试以编程方式重用我之前开发的一些自定义块/模型来构建一个复杂的模型,但我无法连接两个 PMC_Port
这就是我所拥有的:
% Main system
sys_name = 'model';
sys = new_system(sys_name)
open_system(sys_name)
load_system('circuit_cell') % Subsystem with 6 PMC_Port elements
% stored in circuit_cell.mdl file
% Add cell #1
add_block('built-in/Subsystem', [sys_name '/cell1'])
Simulink.BlockDiagram.copyContentsToSubSystem('circuit_cell', [sys_name '/cell1']);
% Add cell #2
add_block('built-in/Subsystem', [sys_name '/cell2'])
Simulink.BlockDiagram.copyContentsToSubSystem('circuit_cell', [sys_name '/cell2']);
% And now I want to connect one cell with the other
add_line('model', 'cell1/1', 'cell2/1', 'autorouting', 'on')
...但我总是收到“无效的 Simulink 对象名称:cell1/1”错误消息。
编辑。- 这是 circuit_cell.mdl 文件:http ://pastebin.com/mXuVFtM3