How to know which block connected with outport block in a subsystem?

조회 수: 9 (최근 30일)
galaxy
galaxy 2021년 7월 13일
편집: Devanuj Deka 2021년 7월 13일
Hi all,
I have outport block in a subsystem.
In outside subsystem, there is block connect with this outport block.
I want to get property of that outside block by command line.
Do any know?
Thank you so much

채택된 답변

Devanuj Deka
Devanuj Deka 2021년 7월 13일
편집: Devanuj Deka 2021년 7월 13일
Hello,
You can have a look at a similar question that has been answered by MathWorks Support Team here: Link
For your specific query, follow these steps:
First get the line handles of your chosen subsystem. (refer get_param, Common Block Properties)
blk_lines = get_param('model/subsystem','LineHandles');
Then use the 'DstBlockHandle' property of the outport lines to get the destination block handles. For the full path of these blocks, use 'getfullname' on the handles. (refer getfullname)
plant_handle = getfullname(get_param(blk_lines.Outport,'DstBlockHandle'));
Here, if your chosen subsystem has multiple outports connecting to multiple blocks, 'plant_handle' is a cell array with the elements being character vectors containing the paths of all the destination blocks. If there is only one outport connecting to a single block, 'plant_handle' is a character vector containing the path of that destination block.
Now that you have the path(s) of the destination block(s), you can get any object parameter of any of the destination blocks using the required property in the 'get_param' function.
For example, for obtaining all 'ObjectParameters' of the first destination block path in the plant_handle cell array:
get_param(plant_handle{1},'ObjectParameters'); % If multiple outports connected to multiple blocks
% get_param(plant_handle,'ObjectParameters'); % If chosen subsystem has only one outport

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subsystems에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by