From: John on
I'm new to matlab and don't really have a clue what this could mean. Matlab returns the following error, but doesn't seem to choke on it. The program is running fine. I am using the CLA command to clear a bunch of axes which were defined earlier as an members of an array.

Here's my code, followed by the error:
global PLOTaxes
set(handles.PLOTbutton,'Enable','on')
for i = 1:length(PLOTaxes(:))
cla(PLOTaxes(i));
legend(PLOTaxes(i),'visible','off')
set(handles.Channel2AnalyzeList,'String',[])
end

??? Error using ==> clo at 41
Bad handle

Error in ==> cla at 29
clo(ax, extra{:});

Error in ==> DataGrabber_GUI>CLEARbutton_Callback at 289
cla(PLOTaxes(i));

Error in ==> gui_mainfcn at 96
feval(varargin{:});

Error in ==> DataGrabber_GUI at 42
gui_mainfcn(gui_State, varargin{:});

Error in ==>
guidemfile>@(hObject,eventdata)DataGrabber_GUI('CLEARbutton_Callback',hObject,eventdata,guidata(hObject))


??? Error while evaluating uicontrol Callback
From: Jan Simon on
Dear John,

> global PLOTaxes
> for i = 1:length(PLOTaxes(:))
> cla(PLOTaxes(i));
> end
>
> ??? Error using ==> clo at 41
> Bad handle
> Error in ==> cla at 29
> clo(ax, extra{:});
> Error in ==> DataGrabber_GUI>CLEARbutton_Callback at 289
> cla(PLOTaxes(i));

Obviously one of the handles in PLOTaxes is not a valid handle. You can check this with ISHANDLE or using the debugger:
dbstop if all error
Then inspect the current "PLOTaxes(i)".

Using the debugger is a good idea ever, because it has a clue what's going on and has access to the actual values - while this newsgroup is populated by some really good cristal ball readers :-), but sometimes, they are beyond.

Kind regards, Jan