axes problem in MATLAB gui
3 views (last 30 days)
Show older comments
Error using ==> axes
Invalid object handle
Error in ==> final>pushbutton14_Callback at 1030 axes(handles.axes1);
WHen i first run the program it worked. But when i click it again, the error appeared? How can i solve this problem?
4 Comments
Juan David Cano-Moreno
on 21 Aug 2014
Edited: Juan David Cano-Moreno
on 21 Aug 2014
The problem using axes(handles.axes1) is that Matlab sometimes loose this reference. You can remind them, using an expression like:
if true
% code
end
axes(handles.axes1)
plot(x,y);% Also with subplots
handles.axes1=gca;
Regards.
Adam
on 21 Aug 2014
Is axes1 embedded in your GUI or is it one you spawned earlier and stored in the handles structure?
Answers (1)
Jan
on 15 Sep 2012
Either handles.axes1 is replaced by an invalid handle, or the corresponding axes object has been deleted. Use the debugger to find out more details, e.g.:
dbstop if error
Then run the function again. Matlab stops when the error occurs, such that you can inspect the value of handles.axes1 manually. If the problem is the deleting of the axes object, check the code until you find the corresponding command - perhaps a clf?
2 Comments
See Also
Categories
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!