MATLAB Answers

David
0

How to edit/modify a Bus Creator Simulink block via Matlab

Asked by David
on 14 Feb 2013
I am using Matlab 2010a and am trying to modify an existing Simulink diagram through a Matlab script. In doing this I am trying to add a new bus creator object of two signals and route that new bus out of the diagram. I can use the add_block function to create the bus creator and outport, and can use the add_line() function to connect those blocks, but the bus creator block is not the right size (number of inputs) and it won't let me change it through the script. It doesn't let me set the number of inputs to the bus object either at the time of creation using the add_block() function, nor does it allow me to change it using the set_param() function after it has been created. It complains that it is read-only or that I can't access the parameters.
How can I create a bus creator with two inputs or edit an existing bus creator to change its number of input to two via the Matlab command prompt?

  0 Comments

Sign in to comment.

1 Answer

Answer by Albert Yam
on 14 Feb 2013

For Matlab2007a, Simulink 6.6.1
>> add_block('simulink/Commonly Used Blocks/Bus Creator', 'test/BC1')
>> set_param('test/BC1','Inputs','15')

  0 Comments

Sign in to comment.