# Plotting into a GUI in Matlab

• MATLAB
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:
if(isappdata(0,'ccestart') && isappdata(0,'cceend'))
axes(maingui.mainscreen)
vline(getappdata(0,'ccestart'),'--k','CCE Start');vline(getappdata(0,'cceend'),'--k','CCE End');
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.