필터 지우기
필터 지우기

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

조회 수: 8 (최근 30일)
Shawn
Shawn 2013년 10월 25일
답변: Zack Peters 2013년 10월 25일
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

답변 (1개)

Zack Peters
Zack Peters 2013년 10월 25일
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

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by