Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plotting into a GUI in Matlab

  1. Jun 25, 2009 #1
    Hello all,
    I've programmed a GUI to read and plot data from oscilloscope. I have a timer function that updates the graph at 1 Hz frequency.
    What I want to is to add two vertical lines to the same figure that mark the beginning and end times of CCE measurement. For that purpose, I'm using the vline -function from Mathworks file central. The code that I've tried to plot those lines with looks like this:

    Code (Text):
    if(isappdata(0,'ccestart') && isappdata(0,'cceend'))
        vline(getappdata(0,'ccestart'),'--k','CCE Start');vline(getappdata(0,'cceend'),'--k','CCE End');
    Basically it just checks that if there exists values for CCE Start and CCE End, which it then uses as the x coordinates.
    The problem is that for about the first five executions of the timer function, it does plot them in the correct figure. But after that, Matlab decides to open a new figure for me. I get no error message, or any reason for that. This is very annoying, and I'd love to know how to fix this bug. Or if it is fixable at all.
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted