axes problem in MATLAB gui

2 次查看(过去 30 天)
Neo
Neo 2012-9-15
评论: Adam 2014-8-21
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 个评论
Juan David Cano-Moreno
编辑:Juan David Cano-Moreno 2014-8-21
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
Adam 2014-8-21
Is axes1 embedded in your GUI or is it one you spawned earlier and stored in the handles structure?

请先登录,再进行评论。

回答(1 个)

Jan
Jan 2012-9-15
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 个评论
Neo
Neo 2012-9-16
i removed cla from my program. but the problem still persists. :(
Image Analyst
Image Analyst 2012-9-16
Look for "clear" or similar, such as "clear all" "clearvars" etc.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by