Buildig a model with .m file

hey,
I have a script I've wrote and during that script I'm turning on Datalogging of some model. Everything went fine when I build the model in Simulink by connect block's lines with the Mouse, But when I create a model with .m file with 'add_block' and 'add_line' commands then when I run the script I got an error says:
'No appropriate method, property, or field unpack for class Simulink.SimulationData.Dataset.'
This Error refer to the command: ' logsout.unpack('all');'
Thanks for helpers!

回答 (1 件)

Robert
Robert 2016 年 8 月 9 日

0 投票

The default type for logsout is a Simulink.SimulationData.Dataset, which does not have an unpack method. The Simulink.ModelDataLogs type does. It sounds like you are using ModelDataLogs in your hand-built model, but a Dataset in your script-build one.

4 件のコメント

Aero
Aero 2016 年 8 月 9 日
So what actually I should do ?
Robert
Robert 2016 年 8 月 10 日
You can set the type in your model with
set_param(myModel,'SignalLoggingSaveFormat','ModelDataLogs') % or 'Dataset'
Sundeepan
Sundeepan 2016 年 9 月 5 日
Is there an alternate way to unpack when using 'Dataset' ? I want to save the data logged by Signal logging into a MAT File and for that I wanted to use unpack('all')
Robert
Robert 2016 年 9 月 6 日
As far as I know, there is no unpack equivalent for Datasets. (But you could always save the variable in the mat file without unpacking it.)

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

カテゴリ

ヘルプ センター および File ExchangeSave Run-Time Data from Simulation についてさらに検索

タグ

質問済み:

2016 年 8 月 9 日

コメント済み:

2016 年 9 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by