How can I get the output and input names of all my subsystem blocks in my simulink model?

조회 수: 126 (최근 30일)
I used Simscape to build a circuit that I divided into different subsystems. Is it possible to read in the inputs and outputs of these subsystem blocks and the name of the subsystem block with a Matlab function like find_system?

채택된 답변

Christopher Wallace
Christopher Wallace 2018년 7월 24일
Yes. What have you tried so far?
Something like this should work.
rootHdl = get_param(bdroot, 'Handle');
sysIns = find_system(rootHdl, 'BlockType', 'Inport');
sysOuts = find_system(rootHdl, 'BlockType', 'Outport');
inportNames = get_param(sysIns, 'Name');
outportNames = get_param(sysOuts , 'Name');
  댓글 수: 1
Alikouider
Alikouider 2021년 12월 7일
Hello,
I would like to Know how I could get the input port of the first level of my system only?
Thanks in advance

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Julian Dieterle
Julian Dieterle 2018년 7월 25일
Thanks a lot!
I get the name of the corresponding subsystem block from:
SubsystemName=get(SysIns,'parent')

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by