I am trying to send data from script to model and get the output data of the simulink model on the script to apply some calculations on them. I tried to use sim command, but it takes long time to run and cause out of memory to my script.
Is there any suggestions on other method that I can use?

5 Kommentare

Pawel Ladosz
Pawel Ladosz am 29 Sep. 2016
Does your sim run in some sort of loop? (i.e. multiple times within single script)
Khaled Abojlala
Khaled Abojlala am 29 Sep. 2016
No, I run sim command at the start of the script only and I get scope output within loop to start applying FFT and other calculations on those data.
Pawel Ladosz
Pawel Ladosz am 29 Sep. 2016
Bearbeitet: Pawel Ladosz am 29 Sep. 2016
1. I assume sim runs much slower than it would if you just run simulink model on its own?
2. How big data you trying to save?
Khaled Abojlala
Khaled Abojlala am 29 Sep. 2016
four parameters with time step 10e-4 for time duration 4 sec. can I send prameter value using sim command or not?
Walter Roberson
Walter Roberson am 29 Sep. 2016
You can set_param() and then sim()

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 29 Sep. 2016

0 Stimmen

You might be able to use "MAT file logging"; see https://www.mathworks.com/help/rtw/ref/mat-file-logging.html
The To Workspace block only sends data at the time the simulation stops or is paused. In the past I have seen tricks for pausing the simulation and automatically restarting. See https://www.mathworks.com/matlabcentral/answers/80934-systematically-pause-simulink-model-and-continue-from-matlab-command-line#answer_90648

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by