MATLAB Answers


Is it possible to use "add_line()" betwen "Model Reference" Blocks

Asked by Lucas S on 26 Jun 2019
Latest activity Commented on by Arvind Sathyanarayanan on 28 Jun 2019
Hello !
I have a System with several "Model Reference" Blocks which have many in and out ports and i'm trying to connect each outport with its same name inport.
But when i try :
add_line(system, Model Name/Outport Name, Model Name/Inport Name);
it returns me an error.
How can i do this ?
Thanks for helping !


Sign in to comment.

1 Answer

Answer by Arvind Sathyanarayanan on 26 Jun 2019
Edited by Arvind Sathyanarayanan on 27 Jun 2019

Your command should be:
%Syntax: add_line('system_name', 'blockname/outport', 'blockname/inport');
add_line(gcs, 'Model/1','Model1/1');


I have thinking of comparing names of each inports and each outports of each models and connect them if it's equal but i have no more idea to do that
Arvind Sathyanarayanan I don't understand why when i do :
find_system('Subsystem Name', 'BlockType', 'Inport');
i can have all ports of the subsystem blocks, but when i do :
find_system('Model Reference Name', 'BlockType', 'Inport');
I have nothing
Can you please post of a screenshot of your actual model so I can better understand what you're trying to do?
Regarding your second comment, you need to load the system before you can use api commands. Try:
load_system('Model Reference Name');
find_system('Model Reference Name', 'BlockType', 'Inport');

Sign in to comment.