필터 지우기
필터 지우기

How can I select programmatically a subplot into a Simulink Data Inspector?

조회 수: 3 (최근 30일)
Paolo Prandi
Paolo Prandi 2017년 4월 3일
답변: Robin Pruss 2018년 3월 12일
I can select number of subplots into a Simulink Data Inspector with:
Simulink.sdi.setSubPlotLayout(1,2)
but I don't know how to select first or second subplot when I check the signal:
Rx = Simulink.sdi.getRunIDByIndex(1); % get the RunID
R = Simulink.sdi.getRun(Rx); % get the RUN
Simulink.sdi.setSubPlotLayout(1,2); % set 2 subplots
for i = 1:R.signalCount % loop for each signal
R.getSignalByIndex(i).checked = true; % check the signal to be drawn
end
Simulink.sdi.view; % display Data Inspector
All signals are plotted into (1,1) subplot. How can I draw some of them into (1,2) subplot?

답변 (3개)

Gillian Rosen
Gillian Rosen 2017년 4월 11일
Unfortunately, it is not currently possible to programmatically select subplots in Simulink Data Inspector. However, there is a MATLAB Central submission that can be used for selecting subplots. Please note that the number of subplots will need to be set manually. In addition, this submission was built for MATLAB R2014b and R2015a, so other versions may throw warnings. You can access this submission at the following link: 
You can also try using the "Saved Views" functionality to plot the signals individually and then load them into your desired view:
This approach will allow you to save the layout, signals, and styling for a view. Then, to load the view into SDI, you can use "Simulink.sdi.loadView('myView')", where 'myView' is an example name for the saved MLDATX file.

Paolo Prandi
Paolo Prandi 2017년 4월 12일
Thanks, I'll try with your suggestion. Do you know if a native implementation is planned?

Robin Pruss
Robin Pruss 2018년 3월 12일
The R2017b version adds this command: plotOnSubPlot
I think it does what you are looking for.

카테고리

Help CenterFile Exchange에서 View and Analyze Simulation Results에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by