MATLAB: How to switch between Model Reference and Subsystems in the model for debugging

referencingsimulinktemplate

When I model my system using Model Reference blocks, it is difficult to debug problems with Model Reference blocks because there is no way to look into the execution of the block like there is in Normal mode.
Also, if I make small changes to my referenced model, I need to rebuild my model each time, which is time consuming and a lot slower than tuning parameters and editing Subsystems.
Is there a way I can switch back and forth between Model Reference and Subsystems?

Best Answer

The attached example in config.zip has a library (called "Config_lib.mdl") that contains a Configurable Subsystem that allows switching between a subsystem implementation and a subsystem wrapped around a Model Reference block (which in turn uses the Subsystem block as its algorithm).
The other files contained in the ZIP-file are:
mtop.mdl - the top level model
Mconfig1.mdl - a referenced model
The Configurable Subsystem in the "Config_lib" library is masked to eliminate the need for two masks. The single source for the algorithm is the Subsystem in the library. The Configurable Subsystem allows for easy switching between a Model Reference implementation and a Subsystem implementation.