Borrar filtros
Borrar filtros

Is it possible to generate a variable number of Simulink blocks?

8 visualizaciones (últimos 30 días)
Shawn
Shawn el 25 de Oct. de 2013
Respondida: Zack Peters el 25 de Oct. de 2013
Hi everyone,
I have a specific custom block in Simulink that I want to be able to generate dynamically upon loading the Simulink file/model. Right now I have to copy and paste it based on how many I want.
For example, if I want 10, I just copy and paste the block 10 times. If I want 30 of them, I copy and paste it 30 times.
However if I want 1000 then it becomes quite difficult to copy and paste it 1000 times. Also, each experiment I do I need a different number of this particular block.
What I would like to be able to do is pass a number like "5" or "6000" when I call the Simulink model and have it generate that many of the block I need.
Is this possible?
Thanks, and warmest regards,
Shawn

Respuestas (1)

Zack Peters
Zack Peters el 25 de Oct. de 2013
Hi Shawn,
Simulink is equipped with command line functionality for model creation. After experimenting with it a bit, you should be able to create a script that can add n blocks to the model and connect them in various ways via the add_block and add_line command.
Here, you should be able to find all of the functions available for manipulating your model from the command line.
~Zack

Categorías

Más información sobre Programmatic 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