MATLAB Plotting into a GUI in Matlab

  • Thread starter Jopi
  • Start date
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:

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.

Want to reply to this thread?

"Plotting into a GUI in Matlab" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving