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

36 visualizaciones (últimos 30 días)
David
David el 14 de Feb. de 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?

Respuestas (1)

Albert Yam
Albert Yam el 14 de Feb. de 2013
For Matlab2007a, Simulink 6.6.1
>> add_block('simulink/Commonly Used Blocks/Bus Creator', 'test/BC1')
>> set_param('test/BC1','Inputs','15')

Categorías

Más información sobre Interactive Model Editing en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by