How can I programmatically clear subplots in Simulation Data Inspector without clearing all runs out of SDI?
Ältere Kommentare anzeigen
I am looking for a command similar to cla but for SDI. In the GUI, I can click a button labeled "Clear Subplot" and then "Clear all Subplots" but I cannot find how to invoke this same behavior in a script. I am trying to automate the plotting of many data runs, and it takes a long time to reload the runs into SDI from the .mat file if I use Simulink.sdi.clear just to clear the subplots!
3 Kommentare
Mikhail
am 9 Jul. 2018
This is how I do it:
function clearSDISignals
% Clear all signals from SDI canvas
Simulink.sdi.close; % SDI window must be closed, otherwise canvas is redrawn, which is slow
runIDs = Simulink.sdi.getAllRunIDs;
for runID = runIDs'
run = Simulink.sdi.getRun(runID);
for signalIdx=1:run.SignalCount
if run.getSignalByIndex(signalIdx).Checked
run.getSignalByIndex(signalIdx).Checked = false;
end
end
end
Simulink.sdi.view;
Raghul Gandhi
am 17 Dez. 2018
If your goal is to plot different runs and capture snapshots, the Simulink.sdi.CustomSnapshot class might be useful. This class provides the clearSignals method to clear plotted signals from all subplots in the CustomSnapshot object.
Ilija
am 3 Mai 2019
I've tried this and it only works if the current axes have focus. Otherwise, i'm unable to change status of 'Checked' field programatically. Does anyone else experiences the same problem? Is there any way to grab handle to SDI axes programatically?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Subplots finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!