Why would a Simulink disabled block still be executed?

2 vues (au cours des 30 derniers jours)
David Lindelöf
David Lindelöf le 27 Oct 2011
I have a MATLAB Fcn block under Simulink, that is part of a disabled subsystem. However, when I start the simulation, I've observed with the debugger that the function in question gets called during the simulation initialization, with a single 0 argument.
After some experimentation, I've observed that this behavior happens only when there's a Unit Delay block somewhere downstream from that block.
Is this a normal behavior? It causes me a lot of trouble as I'd like to disable that subsystem precisely to prevent that function from being called.

Réponses (2)

Nirmal Gunaseelan
Nirmal Gunaseelan le 27 Oct 2011
The MATLAB Fcn block will be executed once before simulation to determine what the dimensions of the output will be. This will happen either during forward propagation or backward propagation and this direction might be affected by the presence of the Unit delay block. Could you try to force the dimensions to be known so that propagation doesn't alter behavior? This can be done by inserting a Signal Specification block right after the MATLAB Fcn block (or actually anywhere before the Unit delay block). Then we can see if this block is still called. The argument 0 seems most likely to be passed to find what the dimensions are.

Guy Rouleau
Guy Rouleau le 27 Oct 2011
Try setting the diagnostic "Underspecified initialization detection" to Simplified, this might help:

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by