Error trying to start Simulink from m-file.

17 次查看(过去 30 天)
In an SImulink model I had two scripts as my Model initializaiton functions (those are called "Achs-Data" and "Init_Sim"). I need to write a new script which runs those two scripts (so I get the variables I need to run Simulink in the workspace) and then starts the simulation. (I can't keep them as the InitFcn's because after the simulation finishes some parameters should be changed an the simulations has to be repeated).
So if i start those scripts in my new script by calling their names (which gets the parameters to the workspace as I want it to be) an then start the Simulation with sim('Gelenkmodell') an error occurs. ("Reibkennlinie_festlegen" is the name of my new script; 'Gelenkmodell' the name of the Simulink model)
How can i avoid this error? Respectively what might me the source of the error?
Sorry if my question is inaccurate, I am pretty new to Matlab.
Error using Reibkennlinie_festlegen (line 17)
Error evaluating 'InitFcn' callback of block_diagram 'Gelenkmodell'.
Callback string is 'Reibkennlinie_festlegen;'
Caused by:
Error using Reibkennlinie_festlegen (line 17)
Cannot start a new command line simulation while an update diagram or a simulation has started for
the same model
  1 个评论
Angel
Angel 2024-4-26
移动:DGM 2024-4-26
I've just encountered the same issue. Too bad no one replied to you yet.

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2024-4-26
It sounds as if the block diagram 'Gelenkmodell' is configured with an InitFcn that invokes Reibkennlinie_festlegen but that Reibkennlinie_festlegen is a script that invokes a simulink model instead of just configuring the current simulink model.

类别

Help CenterFile Exchange 中查找有关 Event Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by