Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

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


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-17LND
Product:   Simulink
Reported in Release:   R11
Platform:   All Platforms
Operating System:   All OS
 

Subject:

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

Problem Description:

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

Solution:

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

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page