Run one step of a simulink model, switch to an m-file, calculate, switch back to the model, run model with new calculated data. (Step wise Simulink execution)
이전 댓글 표시
Hi there,
I have a Simulink model which is generating Data. This Data is the input for some calculation in Matlab. Not just a function, there is a lot of stuff (object oriented) done. The result of the calculation should be the input for the next step of the Simulink model. Now the simulation simulates one time stamp and sends the result to Matlab. Matlab does his calculation and sends the result back to Simulink, and so on.
My problem is, how to synchronize Matlab and Simulink? With "sim()" I can just run all the simulation and do some post processing after everything is finished. But I want to change some parameters during the simulation which will take effect to the results.
I found the "sldebug()" mode witch is doing the step wise execution of the model. But it enters a special debug mode where I can not execute some Matlab code.
Thanks a lot for your help! Kilian
답변 (3개)
Kilian Lenz
2016년 2월 11일
댓글 수: 1
Nitin Babu
2023년 3월 16일
In the pulse generator what should the data be? I need my system to run for 0.1s, pause, do some calcs in matlab, feed that back into simulink mode, and run for the next 0.1s and repeat?
Vaibhav Awale
2016년 1월 13일
0 개 추천
You can run the simulation for one time step using the sim() command. The resulting outputs can be again sent as an input for simulating the model again using sim() command. If you wish to change simulation parameters in between the runs, you can use "set_param" function to set the desired parameters from command window or MATLAB script.
I hope this helps.
Regards,
Vaibhav
댓글 수: 1
Roger Kassouf
2021년 7월 29일
@Vaibhav Awale, may you please share an example of this? I am confused on how one would do this when the internal block states are cleared between runs. Thank you.
krishna teja
2020년 3월 28일
0 개 추천
카테고리
도움말 센터 및 File Exchange에서 Manual Performance Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
