Filter löschen
Filter löschen

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

8 Ansichten (letzte 30 Tage)
Shawn
Shawn am 25 Okt. 2013
Beantwortet: Zack Peters am 25 Okt. 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

Antworten (1)

Zack Peters
Zack Peters am 25 Okt. 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

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by