Dynamic number of Simulink blocks, is it possible?

Is it possible to have simulink model that contains a dynamic number of blocs? E.g. have a model that creates N simulink subsystems of some given type? And how is this done?
Thanks :)
Benjamin

 Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 13 de Mzo. de 2011

1 voto

You can use add_block to programmatically add blocks to a Simulink model. However, you cannot do this while the model is executing (because during this time, the model is locked by the engine, as it needs to be able to rely on the information from model compile).

3 comentarios

Paulo Silva
Paulo Silva el 13 de Mzo. de 2011
One good alternative would be to insert extra blocks (those that would be added dynamically) and while the simulation is running use switches to "route" the signals to those blocks.
Benjamin
Benjamin el 13 de Mzo. de 2011
Awesome, thanks, that makes sense! How do you programmatically make the connections?
Paulo Silva
Paulo Silva el 13 de Mzo. de 2011
You can add User-defined blocks to your model and use the set_param function inside them to change the state of switches.
The embedded function block is probably the easy way but Level-2 M-file
S-Function block also work.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Community Treasure Hunt

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

Start Hunting!

Translated by