hi, i already built slider in GUI, however in this moment i want to run the slider automatically (if i can control by the play and stop is better). how can i do that??? i'm completely stuck thank you!

 Risposta accettata

Image Analyst
Image Analyst il 14 Mag 2012

0 voti

Set the value property of it, after you've set up the max and min properties of course.
set(handles.slider1, 'Min', theMinValue);
set(handles.slider1, 'Max', theMaxValue);
set(handles.slider1, 'Value', theCurrentValue);

8 Commenti

Jan
Jan il 14 Mag 2012
And add a "drawnow" to update the figure.
Hoang Ton
Hoang Ton il 15 Mag 2012
thank for answer
however, this code just jump to exactly value. So can i see data scrolls?
Walter Roberson
Walter Roberson il 15 Mag 2012
You would have to set to intermediate values. Be sure to drawnow() to update the display afterwards.
Hoang Ton
Hoang Ton il 15 Mag 2012
hang on,i will describe briefly about my problem. I have sample data of EEG, I already read, plot, and using slider to view data in short period at the windows. so now i want to autorun slider while i view data.Please explain more your way, and how to apply in my situation. thanks!
Image Analyst
Image Analyst il 15 Mag 2012
Please explain more your way first. What do you mean by autorun slider? Do you want to scroll some data as the user clicks the arrows on the ends of the slider? Or do you want it to move every second or so via a timer? If so see my timer code I posted yesterday.
Hoang Ton
Hoang Ton il 16 Mag 2012
i mean that, instead of clicking the arrows on the end of the slider, i just create button play/pause to control this action. when i click that button the data will auto-scroll like i click the arrows, and when i click that button again, scrolling will stop.Thanks!
Walter Roberson
Walter Roberson il 16 Mag 2012
Start a timer function. It updates the Value of the slider, and calls the slider callback.
cb = get(handles.MySlider,'Callback');
cb{1}(handles.MySlider,[])
When the stop button is pushed, stop the timer.
Evans Njihia
Evans Njihia il 1 Feb 2018
Hi, Its not working on my side. what could be wrong and I want to use a timer to move the slider automatically up and down

Accedi per commentare.

Più risposte (1)

0 voti

Hello, did you finally got it? I am trying the same

1 Commento

Image Analyst
Image Analyst il 19 Ago 2019
I use sliders/scrollbars in GUIDE all the time. If yours doesn't work, attach your .fig and .m file in a new question.

Accedi per commentare.

Categorie

Scopri di più su Just for fun in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by