axes handle does not exist in GUI

Hi, i have a GUI that has one axis.
I am trying to use
plot(handles.axes1,...)
but im getting error:
??? Reference to non-existent field
'axes1'.
Also, printing handles to the console shows that there is a handle for every other widget except the axis.
Why is this?
I'm planning on having more than one plot which is why i need to refer to it using a handle.

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 28일

0 개 추천

Try to run the .fig file instead of the .m file

댓글 수: 2

Jan
Jan 2013년 9월 29일
Do you mean the other way around?
Image Analyst
Image Analyst 2013년 9월 29일
Running either the fig file from GUIDE or the m-file from MATLAB, either way I don't see that as causing the error. Because he has other widgets ID's attached to handles but not axes1, it's clear that there is no axes1 at all, and it's not caused by a "clear all" or something like that.

댓글을 달려면 로그인하십시오.

Image Analyst
Image Analyst 2013년 9월 28일
편집: Image Analyst 2013년 9월 28일

0 개 추천

Obviously you are mistaken and there is no axes with the tag "axes1" - are you sure you used the right case - MATLAB is case sensitive. Put a breakpoint at that plot line, type handles in the command line, and show us what is there. Are you sure there is no member of handles that is listed there that in not associated with a widget?

댓글 수: 4

Edward
Edward 2013년 9월 29일
Im not mistaken, i outputted handles to the console and there was no axes handle. I solved this problem by having an axes create_fcn and setting handles.axes1=hObject; and updating handles that way. Im not sure what caused this problem. If i used more than one plot then there is automatically a handle for the second plot but not the first which is strange. This problem occurs even when i delete all plots and add them back. Thanks for your help
Image Analyst
Image Analyst 2013년 9월 29일
Should not be necessary. When in GUIDE, right-click on the axes you think is axes1. Then view the callback. It will then send you to the m-file. What is the name of the callback function it puts you on in the m-file?
Kai Lutz
Kai Lutz 2016년 4월 18일
I'm having the same problem as Edward. It arose after I've renamed an axes in GUIDE. It updates the m-file, and creates a new create-fcn with the correct name but somehow handles are not updated. Of course the axes exists (gca reveals all axes) but has no tag. Edwards workaround works, but I guess there must be a problem somewhere in GUIDE.
Image Analyst
Image Analyst 2016년 4월 18일
I rename axes frequently. It will update everywhere that tag was in the m-file, including any existing callback and create functions. For me, it does not create a new callback or create function (it just renames existing ones) nor does it create any axes with no tag. And if you type handles in the command window, it does not have the axes's tag missing from the list of fields in handles - it is there with the new name. I'd be willing to believe you if you prove it by running PSR.exe (in Windows from the Start menu) and show you doing it.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

질문:

2013년 9월 28일

댓글:

2016년 4월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by