GUI + Reference to non-existent field

5 visualizzazioni (ultimi 30 giorni)
Amol Khalate
Amol Khalate il 7 Mar 2013
Dear All,
I'm new to Matlab GUI. I'm getting following error when I use GUIDE. "Reference to non-existent field 'axes5'.
Error in Filname>Filname_OpeningFcn(line84)
axes(handles.axes5);
Error in mainfcn(line221)
feval(gui_State.gui_OpeningFcn,gui_hFigure,[],guidata(gui_hFigure),varagin{:});
Error in Filname(line42)
gui_mainfun(gui_State,varagin{:});
Error in guidefunc>layoutActivate(line 1158)
feval(fcn);
Eror in guidefunc(line 13)
varagout=layoutActivate(varagin{:});"
Can anyone suggest
  4 Commenti
Walter Roberson
Walter Roberson il 8 Mar 2013
Wouldn't it be better to postpone the imshow('oce-logo.jpg'); until the open function for axes5 ?
Amol Khalate
Amol Khalate il 8 Mar 2013
Dear Azzi and Walter,
Thanks a lot for taking time to look at my problem. I just realized that I've used the first command 'clear all' to remove other data once I open the GUI. This was clearing the reference to hObject of the main function.
Now, my question to you is this:
If there are some variables with same name in workspace prior to opening the GUI, they are interfering with variables in GUI. This is the reason I thought lets clear the workspace once GUI is open.
How to ensure that the workspace is empty once you open the GUI?

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 8 Mar 2013
You don't need to worry about if there are some variables with the same name in a workspace prior to opening the GUI. They are in a different workspace and will not interfere. Each function has its own local, completely separate set of variables. When you did clear all you blew away your handles structure. Don't do that - if there are variables hanging around in the "base" workspace, it will not affect variables in your functions.

Categorie

Scopri di più su Graphics Objects in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by