Is there a way to access the line information that connects every block in my Simulink model?

61 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
There is no direct way to access the line connectivity, however you can try the following:
%open simulink model vdp.mdl
open_system('vdp')
%Find all the line handles for this model
h = find_system('vdp','FindAll','On','type', 'line');
k = 15; % line 15
%You can use get_param(h(k),'objectparameters') to find all
%the properties for the kth line
%Get the block handles
hblkSrc = get_param(h(k),'SrcBlockHandle');
hblkDst = get_param(h(k),'DstBlockHandle');
%display the line name, source block and destination
%using the SPRINTF command
sprintf('LineName: %s Source Block : %s Destination Block: %s', ...
get_param(h(k),'name'),get_param(hblkDst,'Name'), ...
get_param(hblkSrc,'Name'))

More Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!