How to use a slider to move through plots
Show older comments
I am plotting waveforms that come in at 10 per second. I currently have code that will shift through all of the waveforms collected, one by one, with a small delay between each one, so it almost looks like a stop motion movie. I would like to have something like a slider or the arrow keys to be able to sort through my data back ad forth. I am having troubles though because I have never coded for a slider or push button before. Any help or ideas would be greatly appreciated.
3 Comments
Patrick Lydon
on 30 Jun 2017
dpb
on 1 Jul 2017
So you use a |uicontrol('Style','slider',... and have the callback function set the index to the array start point instead of using the loop.
You'll undoubtedly want to compute the number of waveforms from the total number of points/length(each) and use that as the slider variable instead of absolute points, but it should be pretty straightforward.
Start with
doc uicontrol
and see how the slider works with the example there and modify to suit...
Patrick Lydon
on 3 Jul 2017
Accepted Answer
More Answers (1)
Walter Roberson
on 4 Jul 2017
0 votes
1 Comment
dpb
on 4 Jul 2017
And much nicer looking it is, too! :) I just made Patrick's outline run (and have to admit it's the first uicontrol callback I've ever written (er, debugged/modified)..."I don't do windows" :)
Categories
Find more on Pulse and Transition Metrics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!