Error trying to start Simulink from m-file.

16 visualizaciones (últimos 30 días)
Moritz Koch
Moritz Koch el 27 de Mayo de 2019
Respondida: Walter Roberson el 26 de Abr. de 2024
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 comentario
Angel
Angel el 26 de Abr. de 2024
Movida: DGM el 26 de Abr. de 2024
I've just encountered the same issue. Too bad no one replied to you yet.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 26 de Abr. de 2024
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.

Categorías

Más información sobre Model, Block, and Port Callbacks en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by