繁体   English   中英

MATLAB命令从路径中找到一个输入,在父子系统中对应输入

[英]MATLAB commands to find from the path of an input, the corresponding input in the parent subsystems

我有一个带有连接输入和输出的子系统的 simulink model。 我想使用 MATLAB 命令从输入的路径中找到父子系统中的相应输入。

例子:

我的simulink model

在这里,我想使用 matlab 命令使用“CurrentInput”的路径找到“RootInput”。

我曾尝试使用端口,但并非在所有情况下都有效,而且在 Mathworks 文档中我还没有找到方法。 有解决办法吗?

您可以通过使用找到所有块名称(假设您有一个名为“a.slx”的 model)

b=get_param('a/Subsystem','PortConnectivity') % this will give you connection information of SubSystem.
d=get_param(b(1).SrcBlock, 'BlockType') 

e=get_param(b(1).SrcBlock, 'Name')
f=get_param(b(1).SrcBlock, 'Ports')
h=get_param(b(1).SrcBlock, 'PortConnectivity')
i=get_param(b(1).SrcBlock, 'OutputSignalNames')

您可以使用 get_param() 获得许多参数。 您可以使用的相关功能在https://www.mathworks.com/help/simulink/slref/get_param.html中列出

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM