axes problem in MATLAB gui
2 次查看(过去 30 天)
显示 更早的评论
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
2014-8-21
编辑: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
2014-8-21
Is axes1 embedded in your GUI or is it one you spawned earlier and stored in the handles structure?
回答(1 个)
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 个评论
另请参阅
类别
在 Help Center 和 File 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!