Why would a Simulink disabled block still be executed?

조회 수: 2 (최근 30일)
David Lindelöf
David Lindelöf 2011년 10월 27일
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.

답변 (2개)

Nirmal Gunaseelan
Nirmal Gunaseelan 2011년 10월 27일
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 2011년 10월 27일
Try setting the diagnostic "Underspecified initialization detection" to Simplified, this might help:

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by