MATLAB Answers

Why does Simulink Real-Time hang when I stop running the simulation when File Log blocks are present in my model?

2 views (last 30 days)
I have a Simulink Real-Time model and I am logging about 15 signals at 10kHz using File Log blocks. The model runs in External mode without error, but when I stop the model, Simulink hangs for about 10 minutes. How can I stop this from happening?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Jul 2021
MATLAB/Simulink can be stuck in busy for a while after running on the target with File Log blocks, depending on how much data is logged to the File Log blocks. For large amounts of data, it simply takes time because downloading the files back to the host can take a while. 
One way to workaround this is to turn off "AutoImportFileLog".
In R2021a and later this can be done by starting the simulation from Simulink Real-Time Explorer and unchecking the "AutoImportFileLog" box, instead of starting the simulation from the Simulink window.
Prior to R2021a this must be done by starting the simulation using the "start" command in the MATLAB command line and setting "AutoImportFileLog" to "false". For example, if the target object was in a variable called "tg" and the model was called "model" then you would use the following command:
>> start(tg,'model','AutoImportFileLog',false)
To learn more about how to use the "start" command visit the following documentation link:

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by