Why would a Simulink disabled block still be executed?
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(2 个)
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.
0 个评论
Guy Rouleau
2011-10-27
Try setting the diagnostic "Underspecified initialization detection" to Simplified, this might help:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!