MATLAB Answers


How to update values ​​in a graph taken from a slider

Asked by Carlos Zuñiga on 9 Dec 2012

I'm programming a PID (GUI) for a control system, but I have problems with the sliders. I can not make the graph updates as you move the slider.

I have to do that every time the slider is moved to update the graphics, without pressing any additional buttons.



No products are associated with this question.

1 Answer

Answer by Azzi Abdelmalek
on 9 Dec 2012

You need to insert a plot function inside a slider function callback.


Yes, the problem is that the data is not updated automatically.


slider1_Callback function (hObject, eventdata, hand ....
h = get (handles.slider1, 'value')
sys = feedback (sys, h)
axes (handles.axes1)
rlocus (sys)
grid on

But when you move the slider the graph does not change.

What is sys? can you post the full slider1_Callback function?

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!