How can I comment out a subsystem from the mask initialisation pane (the subsystem is inside the masked subsystem)?

3 次查看(过去 30 天)
I would like to comment out either this or that subsystem from within the mask initialization pane, depending on the user's choice of a certain mask parameter. But when I use the set_param command, I get these error messages Error in 'xyz': Initialization commands cannot be evaluated. Caused by: Block 'xyz' cannot be commented during execution of a callback
Is this impossible in general, or do I have to use some tricks here?

回答(2 个)

Kiran
Kiran 2016-2-8
Hi Hans,
The ability to comment out blocks from inside the block callback during the initialization phase is not available in Simulink.
This is expected behavior because the Simulink solver decides the block executing order during the model compilation phase. Therefore, commenting out blocks would be an unexpected behavior for the solver and the model would give an error message.
To enable this kind of behavior, you may use a variant subsystem with a subsystem variant that is just a direct feed-through from the inport to the outport.
Hope this would help.

Hans Esders
Hans Esders 2016-2-8
Hello Kiran, thank you very much for this explanation.
I used enabled subsystems now as a workaround. Do you see any disadvantages compared to your proposal?
Best regards,
Hans

类别

Help CenterFile Exchange 中查找有关 Subsystems 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by