Error evaluating 'InitFcn' callback of block_diagram 'SIMULINK_MODEL'. Callback string is 'MATLAB_MODEL' Caused by: Error using MATLAB_MODEL
Ältere Kommentare anzeigen
Hello everyone,
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'
Caused by:
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?
Antworten (1)
Fangjun Jiang
am 13 Mär. 2023
0 Stimmen
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.
2 Kommentare
Gabriella
am 13 Mär. 2023
Fangjun Jiang
am 13 Mär. 2023
" 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
ModelName='SIMULINK_MODEL_v20180919';
open_system(ModelName);
output=sim(ModelName);
Kategorien
Mehr zu Model, Block, and Port Callbacks finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!