Remove same types of Simulink blocks using commands
Mostrar comentarios más antiguos
I added multiple Simulink blocks (Dashboards,To workspace etc) in my model in order to test its behavior that I now need to remove without opening the model manually in order to have a clean model to generate C code.
Is there an existing command/script to delete same type of blocks from a system without specifing the path (using gcb/get_param/delete_block commands)?
Respuesta aceptada
Más respuestas (1)
Jonas
el 10 de Nov. de 2020
Hi David
I don't know the answer to your specific question, but I may provide you with other options to cope with your problem.
Firstly, some blocks are automatically eliminated away before code generation, such as Dashboards, Scope blocks, terminator blocks, etc. So it may be that some blocks already are not affecting the code generation.
However, some blocks may indeed still remain in the code although you don't want to generate code for it. So secondly, I may suggest to put those blocks inside a variant subsystem. Then, use the following variant condition:
strcmp('ert.tlc',get_param('controller','SystemTargetFile'))
This will change the variant depending on if you are generating code with Embedded Coder, or if you are simulating (then the target file would be grt.tlc) or if you are rapid prototyping with Simulink Real-time. The variant for code generation use would be an empty block, while for the other uses you put the To Workspace blocks inside for example. Dashboards themselves don't need to be put inside the variant subsystem, but the blocks that generate the signals which are shown on the Dashboard may be put inside the variant subsystem.
With kind regards,
Jonas
Categorías
Más información sobre Event Functions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!