How can I remove a line off UIAxes on App designer in RealTime with SpeedGoat
Hi,
Im creating an app using App designer and Simulink in Realtime with a speedgoat. I have a drop down menu that has a selection of position or velocity. Depending on what is selected I want to plot it on a UIaxes. However, for instance, when I go from velocity to poisition or vice versa, The graph keeps both lines on the UIAxes. I only need to show one line that corresponds to the value of the dropdown list. Im using connectline() command to plot. I tried using clearScalarAndLineData() command to clear the axes but it is not working. My issue is that I cannot get rid of a line once I use the connectline() command. I also tried using cla() but once I use it, it will not replot during the simulation.
My desire is to have when the dropdown list equals to position, the UIaxes will plot only the position signal and when the dropdown list equals velocity, it will only plot the velocity signal during simulation.
Here is my code so far
function PlotSelectValueChanged(app, event)
value = app.PlotSelect.Value;
if value == "Position"
app.Instrument = slrealtime.Instrument(app.SLRTApp);
addInstrumentedSignals(app.Instrument)
app.Instrument.connectLine(app.DataPlotAxes,"Pos_AX1");
app.Instrument.AxesTimeSpan = 10;
app.Instrument.AxesTimeSpanOverrun = ‘wrap’;
app.InstrumentManager = slrealtime.ui.tool.InstrumentManager(app.BenchTopUIFigure, ‘TargetSource’, app.TargetSelector);
app.InstrumentManager.Instruments = app.Instrument;
elseif value == "velocity"
app.Instrument = slrealtime.Instrument(app.SLRTApp);
addInstrumentedSignals(app.Instrument)
app.Instrument.connectLine(app.DataPlotAxes,"Vel_AX1");
app.Instrument.AxesTimeSpan = 10;
app.Instrument.AxesTimeSpanOverrun = ‘wrap’;
app.InstrumentManager = slrealtime.ui.tool.InstrumentManager(app.BenchTopUIFigure, ‘TargetSource’, app.TargetSelector);
app.InstrumentManager.Instruments = app.Instrument;
end
end
ThanksHi,
Im creating an app using App designer and Simulink in Realtime with a speedgoat. I have a drop down menu that has a selection of position or velocity. Depending on what is selected I want to plot it on a UIaxes. However, for instance, when I go from velocity to poisition or vice versa, The graph keeps both lines on the UIAxes. I only need to show one line that corresponds to the value of the dropdown list. Im using connectline() command to plot. I tried using clearScalarAndLineData() command to clear the axes but it is not working. My issue is that I cannot get rid of a line once I use the connectline() command. I also tried using cla() but once I use it, it will not replot during the simulation.
My desire is to have when the dropdown list equals to position, the UIaxes will plot only the position signal and when the dropdown list equals velocity, it will only plot the velocity signal during simulation.
Here is my code so far
function PlotSelectValueChanged(app, event)
value = app.PlotSelect.Value;
if value == "Position"
app.Instrument = slrealtime.Instrument(app.SLRTApp);
addInstrumentedSignals(app.Instrument)
app.Instrument.connectLine(app.DataPlotAxes,"Pos_AX1");
app.Instrument.AxesTimeSpan = 10;
app.Instrument.AxesTimeSpanOverrun = ‘wrap’;
app.InstrumentManager = slrealtime.ui.tool.InstrumentManager(app.BenchTopUIFigure, ‘TargetSource’, app.TargetSelector);
app.InstrumentManager.Instruments = app.Instrument;
elseif value == "velocity"
app.Instrument = slrealtime.Instrument(app.SLRTApp);
addInstrumentedSignals(app.Instrument)
app.Instrument.connectLine(app.DataPlotAxes,"Vel_AX1");
app.Instrument.AxesTimeSpan = 10;
app.Instrument.AxesTimeSpanOverrun = ‘wrap’;
app.InstrumentManager = slrealtime.ui.tool.InstrumentManager(app.BenchTopUIFigure, ‘TargetSource’, app.TargetSelector);
app.InstrumentManager.Instruments = app.Instrument;
end
end
Thanks Hi,
Im creating an app using App designer and Simulink in Realtime with a speedgoat. I have a drop down menu that has a selection of position or velocity. Depending on what is selected I want to plot it on a UIaxes. However, for instance, when I go from velocity to poisition or vice versa, The graph keeps both lines on the UIAxes. I only need to show one line that corresponds to the value of the dropdown list. Im using connectline() command to plot. I tried using clearScalarAndLineData() command to clear the axes but it is not working. My issue is that I cannot get rid of a line once I use the connectline() command. I also tried using cla() but once I use it, it will not replot during the simulation.
My desire is to have when the dropdown list equals to position, the UIaxes will plot only the position signal and when the dropdown list equals velocity, it will only plot the velocity signal during simulation.
Here is my code so far
function PlotSelectValueChanged(app, event)
value = app.PlotSelect.Value;
if value == "Position"
app.Instrument = slrealtime.Instrument(app.SLRTApp);
addInstrumentedSignals(app.Instrument)
app.Instrument.connectLine(app.DataPlotAxes,"Pos_AX1");
app.Instrument.AxesTimeSpan = 10;
app.Instrument.AxesTimeSpanOverrun = ‘wrap’;
app.InstrumentManager = slrealtime.ui.tool.InstrumentManager(app.BenchTopUIFigure, ‘TargetSource’, app.TargetSelector);
app.InstrumentManager.Instruments = app.Instrument;
elseif value == "velocity"
app.Instrument = slrealtime.Instrument(app.SLRTApp);
addInstrumentedSignals(app.Instrument)
app.Instrument.connectLine(app.DataPlotAxes,"Vel_AX1");
app.Instrument.AxesTimeSpan = 10;
app.Instrument.AxesTimeSpanOverrun = ‘wrap’;
app.InstrumentManager = slrealtime.ui.tool.InstrumentManager(app.BenchTopUIFigure, ‘TargetSource’, app.TargetSelector);
app.InstrumentManager.Instruments = app.Instrument;
end
end
Thanks simulink, appdesigner MATLAB Answers — New Questions