Truncated "to workspace" data from Simulink model during external mode: only the latest data are correctly saved.

17 ビュー (過去 30 日間)
Hi everyone, I'm experiencing an annoying issue when saving data from running a Simulink model in external mode. If a "to workspace" block is inserted into the model and regardless the type of data required (time series/array/structure), only a small random number between 100 and 1000 of the entire data are effectively stored in the workspace variable, corresponding to the very little end of those actually generated by the model. Data points are set to infinite in the block dialog so I can not figure out why this truncation takes place, and why the data length appears so unpredictable. For the sake of clarity, I'm working with Ubuntu 14.04 running Matlab R2014b and Simulink is used in external mode with a fixed sample time. Many thanks to all those will help me.


Vidya Viswanathan
Vidya Viswanathan 2016 年 4 月 1 日
Hi Alberto,
Could you clarify if you are trying to run the model in Arduino? What is the sample time used? Typically, the gap in output data is observed when the sample rate is less than 10ms because the target tries to upload the data to the host every few seconds.
To resolve the issue,
1) Please increase the duration further in your model and see if it satisfies your requirements. Ideally, it is not recommended to run external mode on Arduino targets at very high rates (such as 1 ms).
2) If your requirement is to have data archiving at very high speeds, it is recommended to use a serial block for data upload. You would then use an ICT receive block on the Host to log data into MATLAB.
I hope this addresses your query. If this does not resolve the issue, please feel free to contact MathWorks Technical Support corresponding to your geographical location. You could reach them through the following link:
Vidya Viswanathan

その他の回答 (2 件)

minkow38 2017 年 9 月 6 日
Hi Alberto,
I've faced issue in terms of logging data, I only had at best the last 1000samples that were saved to my workspace after running my simulink model in external mode.
I've found a solution in mathworks documentation:
If you change the "Duration" parameter in "External & triggering Signals" window that should help you.

Giorgio Concu
Giorgio Concu 2017 年 12 月 6 日
I had the same proble withe R2015b and I fix it just upgrading to 2016b or higher.


Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by