SDIで変数名がunnamedになる

6 views (last 30 days)
Kou Satou
Kou Satou on 16 Jul 2019
Answered: Kou Satou on 16 Jul 2019
早速ですが以下質問させてください。
Simulinkのシミュレーション データ インスペクタ:以下SDIで作図する際、Simulinkの信号のログで保存したDatasetではなく、
以下の方法で作成したDatasetを用いてSDIでデータをインポートすると変数名がunnamedになってしまいます。
  time = 0.1*(0:100)';
  ds = Simulink.SimulationData.Dataset;
  element1 = Simulink.SimulationData.Signal;
  element1.Name = 'A';
  element1.Values = timeseries(sin(time),time);
  ds{1} = element1;
  element2 = Simulink.SimulationData.Signal;
  element2.Name = 'B';
  element2.Values = timeseries(2*sin(time),time);
  ds{2} = element2;
  element3 = Simulink.SimulationData.Signal;
  element3.Name = 'C';
  element3.Values = timeseries(3*sin(time),time);
  ds{3} = element3;
ワークスペース上のDatasetはA,B,Cの変数名ついているが、SDIでデータをインポートすると変数名がunnamedになってしまう。
変数名がunnamedにならないようにSDIにデータをインポートする方法を教えてください。

Accepted Answer

Kohei Iwamoto
Kohei Iwamoto on 16 Jul 2019
以下の様にtimeseriesデータに変数名を付与することで、SDIに表示されます。
clear ds
time = 0.1*(0:100)';
ds = Simulink.SimulationData.Dataset;
%element1追加
element1 = Simulink.SimulationData.Signal;
element1.Values = timeseries(sin(time),time);
element1.Values.name = 'A';
ds{1} = element1;
%element2追加
element2 = Simulink.SimulationData.Signal;
element2.Values = timeseries(2*sin(time),time);
element2.Values.name = 'B';
ds{2} = element2;
%element3追加
element3 = Simulink.SimulationData.Signal;
element3.Values = timeseries(3*sin(time),time);
element3.Values.name = 'C';
ds{3} = element3;
[~,~,signalIDs] = Simulink.sdi.createRun('Test','base',{'ds'});
Simulink.sdi.view;

More Answers (1)

Kou Satou
Kou Satou on 16 Jul 2019
回答ありがとうございます。
教えて頂いたelement1.Name = 'A'; をelement1.Values.name = 'A'; にする事で、
問題なく変数名がSDI上で表示されるようになりました。

Products

Community Treasure Hunt

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

Start Hunting!