I am designing a gui (my first one) with guide and I'm having some problems with certain plotting (text) options. I have two sets of axes objects in my gui which are used for graphing purposes. I also have a set of check boxes corresponding to each set of axes that do simple analysis (min, max, average). when each check box is toggled on, say for the "min" of "plot1" axes, a text box gets populated by a number corresponding to the minimum value of the data and a text object printed on the graph pointing to the corresponding value on the graph.
here's the code segment:
In my check box callback function : axes(handles.Plot1);
if (get(handles.Panel1Min, 'Value') == get(handles.Panel1Min,'Max')) %check toggle on if data1MinInd>floor((length(P1t)/2)-1) handles.text = text(t(data1MinInd),data1Min,['some text']); elseif data1MinInd<=floor((length(P1t)/2)-1) handles.text = text(t(data1MinInd),data1Min,['some other text']); end else set(handles.P1MinText,'String',''); % if toggled off, text box is cleared end
what I'm struggling is clearing the text from the plot when the check box is toggled off.
Things I have tried:
1) saving the "text" handle object everytime the toggle is on (because when it's off the handle doesn't exist), and check it agains the toggle before the conditional statements above in the check box callback function.
2) using the delete command and passing the "text" handle object as an input argument.
Does the line "axes(handles.Plot1)" in anyway interfere with "text" handle assignment by making it a child?
I would appreciate any help or hints that would set me on the right path to solving the problem.