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

Thread Subject:
GUI slider

Subject: GUI slider

From: Veneree

Date: 27 Nov, 2012 17:04:10

Message: 1 of 3

Hi,
I would like to check if the slider has been moved or not in a GUI. How could I do that?
Thanks

Subject: GUI slider

From: Kristin

Date: 7 Dec, 2012 13:26:08

Message: 2 of 3

"Veneree" wrote in message <k92rqa$59c$1@newscl01ah.mathworks.com>...
> Hi,
> I would like to check if the slider has been moved or not in a GUI. How could I do that?
> Thanks

% initialize the slider with some data in the UserData property:
initial_val=0;
set(slider_handle, 'Value', initial_val);
set(slider_handle, 'UserData', initial_val);

% Check on the value
new_val = get(slider_handle, 'Value');
old_val = get(slider_handle, 'UserData');
if old_val == new_val
    set(slider_handle, 'UserData', new_val);
end

Or i guess you can use persistent variables, but I do not much about them.

Subject: GUI slider

From: Yair Altman

Date: 8 Dec, 2012 16:28:08

Message: 3 of 3

"Kristin" wrote in message <k9sqpg$7bb$1@newscl01ah.mathworks.com>...
> "Veneree" wrote in message <k92rqa$59c$1@newscl01ah.mathworks.com>...
> > Hi,
> > I would like to check if the slider has been moved or not in a GUI. How could I do that?
> > Thanks
>
> % initialize the slider with some data in the UserData property:
> initial_val=0;
> set(slider_handle, 'Value', initial_val);
> set(slider_handle, 'UserData', initial_val);
>
> % Check on the value
> new_val = get(slider_handle, 'Value');
> old_val = get(slider_handle, 'UserData');
> if old_val == new_val
> set(slider_handle, 'UserData', new_val);
> end
>
> Or i guess you can use persistent variables, but I do not much about them.


To monitor continuous slider movements see here:
http://UndocumentedMatlab.com/blog/continuous-slider-callback/

Yair Altman
http://UndocumentedMatlab.com
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us