How to save logged signal to a MAT file without using 'TO WORKSPACE' block ?

5 ビュー (過去 30 日間)
Sundeepan
Sundeepan 2016 年 8 月 31 日
コメント済み: meme samy 2017 年 12 月 20 日
I have a MATLAB GUI which can be used to run multiple simulations and plot results. The user selects the signals by clicking on the signal (which are selected by the GUI using Signal Logging).
Additionally, I want to save all the user selected signals into a MAT file. Is there a meathod to save the logged signals in SImulink model into a MAT file ?

採用された回答

Fangjun Jiang
Fangjun Jiang 2016 年 8 月 31 日
If it is done through customized GUI, it might depend on the customized GUI.
If it is done through right click the signal line, select "Signal Properties ....", check "Log signal data" and specify a name.
In the model menu "Simulation", "Configuration Parameters ...", "Data Import/Export", check "Signal logging". By default, the signal logging is saved in the variable logsout in the MATLAB workspace. You can then save logsout to a .mat file.
logsout is an object. Use logsout.unpack('all') to unpack the signal logging.
  3 件のコメント
Fangjun Jiang
Fangjun Jiang 2016 年 8 月 31 日
I am not aware of a method to save signal logging directly to a .mat file. There is a block called "To File". I doubt that is what you want.
Sundeepan
Sundeepan 2016 年 9 月 6 日
I tried using unpack('all') but it works only for Simulink.ModelDataLogs or Simulink.SubsysDataLogs and not for Dataset. I require the logged signals as dataset as all the logged signals are also plotted:
plot(figure_name, logsout.getElement(signal).Values.Time,logsout.getElement(signal).Values.Data);
Is there a alternative to unpack('all') to extraxt the data and save in a mat file ?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSave Run-Time Data from Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by