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

7 views (last 30 days)
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?

Answers (2)

Kiran
Kiran on 8 Feb 2016
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 on 8 Feb 2016
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

Products

Community Treasure Hunt

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

Start Hunting!