Update curve in GUI figure as slider is changed

1 回表示 (過去 30 日間)
Matthew Saul
Matthew Saul 2014 年 12 月 18 日
回答済み: Stephen23 2014 年 12 月 18 日
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 件のコメント
Stephen23
Stephen23 2014 年 12 月 18 日
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.

サインインしてコメントする。

採用された回答

Stephen23
Stephen23 2014 年 12 月 18 日
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 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by