MATLAB Answers

0

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

Asked by Julian Dieterle on 24 Jul 2018
Latest activity Answered by Julian Dieterle on 25 Jul 2018
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?

  0 Comments

Sign in to comment.

2 Answers

Answer by Christopher Wallace on 24 Jul 2018
 Accepted Answer

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');

  0 Comments

Sign in to comment.


Answer by Julian Dieterle on 25 Jul 2018

Thanks a lot!
I get the name of the corresponding subsystem block from:
SubsystemName=get(SysIns,'parent')

  0 Comments

Sign in to comment.