簡體   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