Update curve in GUI figure as slider is changed
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Matthew Saul
am 18 Dez. 2014
Beantwortet: Stephen23
am 18 Dez. 2014
I have a GUI with 1 figure. I have a series of radio buttons that plot data on the figure when they are checked on. The hold on command is used so as each button is checked the existing data remains on the plot.
I have a slider whose value is used as a variable to plot a curve on the same figure. I want the curve to refresh as the slider is moved. I can't seem to get the previous curves to remove from the figure as i move the slider. Basically as I keep moving the slider around i get more and more curves on the plot. I only want the curve at the latest slider position to show on the plot. I think it has to do with the hold on commands associated with plotting the initial data on the figure.
I have attached core for how I have tried to do it.
1 Kommentar
Stephen23
am 18 Dez. 2014
Don't use a screenshot, please edit your question and use the {} Code button above the text box to add code into your text. This means that we don't have to write everything from scratch, and that we have the same code to work with as you do.
Akzeptierte Antwort
Stephen23
am 18 Dez. 2014
You might be interested to have a look at this:
http://www.mathworks.com/matlabcentral/fileexchange/5253-scrolling-figure-demo
My own submission "cubehelix" includes a demo figure plotting function with this behavior:
http://www.mathworks.com/matlabcentral/fileexchange/43700-cubehelix-colormaps
In a nutshell: don't plot new data on every callback, instead use set to update already existing data in your axes.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!