首页 > 解决方案 > Simulink 到 TargetLink 端口的转换

问题描述

我正在尝试用目标链接块(输入和输出)替换 Simulink 块。这些 TL Inports 和 Outports 存在于 TARGET 链接库中。


    expModel = gcs;
    Inports= find_system(expModel,'LookUnderMasks','all','FollowLinks','on','Regexp','on','SearchDepth',1,'BlockType','Inport');
    Inports_Handle = get_param(Inports,'handle');
    NewTL_Inport = replace_block(Inports_Handle,'Inport','tllib/InPort');
    
    % Replace the user selected subsytem for Simulink I/O By Target Link I/O 
    Outports = find_system(expModel,'LookUnderMasks','all','SearchDepth',1,'LookUnderMasks','all','FollowLinks','on','BlockType','Outport');
    Outports_Handle = get_param(Outports,'handle');
    NewTL_Outport = replace_block(Outports_Handle,'Outport','tllib/OutPort');

  1. 此外,我面临 Outport 的错误“系统必须是有效的模型或子系统名称”-(原因可能是我要替换的输出端口连接到开关块而不是子系统)
  2. 有没有其他方法可以代替使用替换块功能
  3. 观察 - 模型中的 Inport 被替换。

谢谢你的支持。

标签: matlabscripting

解决方案


推荐阅读