- Yes, you can configure Model Callback Functions to call MATLAB code at specific times in the model lifetime. You can use PostLoadFcn to call something right after a model has been loaded, and InitFcn to call during model update, or right before simulation.
- You can run MATLAB-file during simulation (as if it were one of the blocks) using the Interpreted MATLAB Function, but initial conditions are needed at the beginning of simulation, so using the InitFcn callback is a better place to do that.
running m-file from Simulink
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Khristopher
am 1 Dez. 2011
Beantwortet: manu kasturi
am 6 Jun. 2019
Hi,
I have a m-file with the initial conditions for a simulink model. Currently I manually run the file before I run the simulation.
My questions are as follow:
1. Is there a way to have simulink automatically run the m-file when I, either open the model, or start the simulation?
2. Would it be possible to run the m-file with the initial conditions during the simulation?
Further Information for question 2:
The m-file with the initial conditions contains various parameters that depend on how the user decides to run the simulation (manually or using autonomy) (it's basically a flight sim). I would like to be able to change flight modes within the simulation by simply re-running the m-file.
Thank you very much in advance for your time.
0 Kommentare
Akzeptierte Antwort
Kaustubha Govind
am 1 Dez. 2011
3 Kommentare
Manikandan R
am 16 Mär. 2019
Bearbeitet: Manikandan R
am 16 Mär. 2019
if my m file contains printing satements it is not on the comaand window why???
Weitere Antworten (1)
manu kasturi
am 6 Jun. 2019
I have a similar kind of problem.
In my case, I want user to select one m script from a list.
Could you please help me in this regard?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Model, Block, and Port Callbacks finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!