MATLAB Answers

Is there a way to link plots to simscape log data / simscape results explorer data?

조회 수: 2(최근 30일)
Andreas 2021년 6월 9일
편집: Andreas 2021년 6월 10일
When you enable data logging for simscape, you can browse all simulation data using the simscape results explorer.
After selecting sveral data nodes, it is possible to "extract current plot into new figure window". I would like to customize my figure and link it to the simulation data but cannot figure out how.
Simlog won't show up as data source and there is also no auto-linking in the data source dialogue.
Any idea or help?

채택된 답변

Yifeng Tang
Yifeng Tang 2021년 6월 10일
You may access everything in simlog through MATLAB base workspace. This documentation page includes some basic functions to access and plot the logged data:
To take it one step further, you can extract the time and value (in any reasonable unit you wish) of a simlog signal series, and use them as base workspace variables. Then you can "hold on" and plot several of them together.
The "time" and "values" functions/methods of the series will give you the access you need.
Some pseudo-code:
% run some simulation first
t = time(simlog.motor.w.series); % all signal should have the same time stamps
v1 = values(simlog.motor.w.series,'rpm'); % specify unit
v2 = values(simlog.motor.v.series); % default unit
figure(1); clf;
hold on;
I believe you can also do
t = simlog.motor.w.series.time;
v1 = simlog.motor.w.series.values('rpm')

추가 답변(1개)

Yifeng Tang
Yifeng Tang 2021년 6월 10일
You may access everything in simlog through MATLAB base workspace. Follow the instructions on the following documentation page and you will be able to use commands like "plot" and all of its options to customize your figures. You probably will end up with a post-process script once you figure out what you want to plot.
  댓글 수: 6
Andreas 2021년 6월 10일
@Yifeng Tang I am more of a wysiwyg-guy and try to customize figures with the figure toolbox (I am bad at scripting) ;-)
The data link solution works fine for me, hence the created figure can be used for a series of models all with the same block name scheme.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by