Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Dynamic Plot Update in a GUI
Replies: 5   Last Post: Jul 12, 2013 1:04 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ralph Schleicher

Posts: 29
Registered: 1/23/10
Re: Dynamic Plot Update in a GUI
Posted: Jul 10, 2013 4:36 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Chad " <chad.timmins@scimar.com> writes:

> I created a gui that loads a file and its data and then does some
> spectal estimation calulation and plots the result. However, the plot
> only shows up and updates after I hit the plot button. I am trying to
> have it plot immediately after the user selects the input data and
> automatically update when the value of the sliders change. I know I
> can put all the plot functions in the slider call back, but I am
> trying to keep my code as short as possible and want to create one
> function that gets all the slider values and input data from
> getappdata and then updates the plot without having to push any other
> button.


Pseudocode follows.


function event_handler(event)

switch event
case 'select_input_data'
store_input_data;
set_plot_dirty(true);
case 'slider_change'
store_slider_value;
set_plot_dirty(true);
end

update_plot;

function update_plot

if ~get_plot_dirty
return;
end

fetch_input_data;
fetch_slider_value;
% ...
set_plot_dirty(false);

drawnow;

--
Ralph



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.