Error evaluating 'InitFcn' callback of block_diagram 'SIMULINK_MODEL'. Callback string is 'MATLAB_MODEL' Caused by: Error using MATLAB_MODEL
52 views (last 30 days)
Show older comments
Gabriella on 13 Mar 2023
Commented: Fangjun Jiang on 13 Mar 2023
I am trying to link MatLab with ModeFrontier but I need to automatically get the results of the Simulink model in MatLab. Searching online, I found the Sim command but it gives me error (see below).
I write in MatLab 'sim("SIMULINK_MODEL", stop_time)'
The error is: Error evaluating 'InitFcn' callback of block_diagram 'SIMULINK_MODEL_v20180919'.
Callback string is 'MATLAB_MODEL_v20180919'
Error using MATLAB_MODEL_v20180919
Cannot start a new command line simulation while an update diagram or a simulation has started for
the same model
If I click in 'InitFcn', it opens the Model Properties tab of Simulink where I can see that the Matlab model is used as model initialization function (InitFcn). Please, does anyone have an idea how I can solve the issue or get the data in MatLab differently?
Most likely, it is looking for a file named "MATLAB_MODEL_v20180919.m". Search for that file and check if the folder is in your MATLAB path.
You could also try this. Start MATLAB, open your simulink model, click "Play" to run simulation. The same error probably will happen. You need to follow the same approach above to resolve it.
" Cannot start a new command line simulation while an update diagram or a simulation has started for
the same model"
Maybe you have a circular calling sequence? If your manuall process works properly, then all you need to make it automatic is to create a new .m file and add these lines
Find more on Model, Block, and Port Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!