Can I plot an entire vector in the Simulink Data inspector ?
2 ビュー (過去 30 日間)
古いコメントを表示
I often save data in the Simulation data inspector (SDI) when I run a model to analyse the results. I work with a lot of vectors and I'm looking for a way to plot all the elements of the vectors in the same plot. For now, I only managed to plot elements individualy but the dimension of the vecteur is to large to select all of them one by one.
Do you know a way to do that ?
0 件のコメント
採用された回答
Hari Veerubhotla
2020 年 9 月 16 日
Hi,
As per my understanding, you have a vector of signals which are you are planning to plot in SDI at once.
If you are planning to do this through UI, you can select the RUN in Simulink Data Inspector and click CONTROL + A + SPACE, which will plot all the signals under that RUN.
Selecting a set of signals inside a RUN and pressing SPACE would basically check/uncheck the signals and subsequently plot/un-plot them from the plot area.
If you are planning to this through programmatically, you can iterate over list of signals in the RUN and use the plotOnSubPlot() APi to plot signals.
Below is the code-snippet which does that.
// creating vector with list of signals.
sine_vals = sin(2*pi/5*time);
sine_ts = timeseries(sine_vals,time);
sine_ts.Name = 'Sine, T=5';
cos_vals = cos(2*pi/8*time);
cos_ts = timeseries(cos_vals,time);
cos_ts.Name = 'Cosine, T=8';
vec = [sine_ts, cos_ts]
// Run creation with created vector
runID = Simulink.sdi.createRun("Sample_Run","vars", vec);
runObj = Simulink.sdi.getRun(runID);
// Launch SDI
Simulink.sdi.view;
//Iterate over signals and plot them in SDI
for index = 1:runObj.SignalCount
signalObj = runObj.getSignalByIndex(i);
// Plot signal on the first plot in the layout
plotOnSubPlot(signalObj, 1,1,true);
end
-Thanks
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Analyze Simulation Results についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!