Simulation runs fine despite error (index out of bounds)
3 visualizaciones (últimos 30 días)
For my simple model, Simulink (R2020b) throws an error during Model Update, but afterwards allows me to simulate (run) the model without any problems. In my understanding, an error during Model Update should make the Model Update unsuccessful and prevent me from running the simulation. The error does not occur using R2018b and R2019b. I wonder whether this is a bug.
Steps to reproduce
Create an empty model. Insert and connect the following blocks as shown in the screenshot: Integrator, MATLAB Function, Mux, Demux, Terminator. Change the code for the MATLAB Function as shown in the screenshot. Activate "Signal Dimensions" and "Non-scalar lines" in Debug --> Information Overlays --> Signals. Do not change any other default settings.
During Model Update, Simulink (R2020b) shows this error message:
The error messages argues that accessing x(2) is invalid. Despite the error, Simulink has identified the correct signal dimensions (see block diagram) and allows running a simulation without any problems.
That is a minimal example I found to demonstrate the problem. It does not do anything useful. I know I can suppress the error by specifying the dimension ("2") of one of the ports of "fcn" or by using a Signal Specification block on either of the non-scalar signal lines. No need to tell me that. That's not my question. If Simulink finds an error, it should stop me. And if there's no problem, Simulink shouldn't throw an error. And I wonder why the behavior changed somewhere between R2019b and R2020b.
Thanks for your help!
Deepak Meena el 28 de Feb. de 2021
I also run the example you described, I am also getting the error you described but my simulation is not running after the error , let me know how do you know ,your simulation is working after the Error.