Why would a Simulink disabled block still be executed?

2 visualizaciones (últimos 30 días)
David Lindelöf
David Lindelöf el 27 de Oct. de 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.

Respuestas (2)

Nirmal Gunaseelan
Nirmal Gunaseelan el 27 de Oct. de 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 el 27 de Oct. de 2011
Try setting the diagnostic "Underspecified initialization detection" to Simplified, this might help:

Categorías

Más información sobre Simulink Functions en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by