Effacer les filtres
Effacer les filtres

How to solve this error "Reference to non-existent field 'axes5".

3 vues (au cours des 30 derniers jours)
Kaavya N
Kaavya N le 19 Juin 2021
Commenté : Walter Roberson le 22 Juin 2021
I have created a GUI using GUIDE, the tag name is axes5, and the code of the callback function is as follows,
While execution of the program i'm getting the following error shown above in the picture. What might be the issue?
%------------------------------------------------------------------------------------
function stego_image_Callback(hObject, eventdata, handles)
% hObject handle to stego_image (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load out;
[filename, pathname] = uigetfile('*.mat', 'Pick an M-file');
if isequal(filename,0) || isequal(pathname,0)
disp('User pressed cancel');
end
axes(handles.axes5);
imshow(out,[]);
%-------------------------------------------------------------------------------------
  2 commentaires
Kaavya N
Kaavya N le 19 Juin 2021
GUI picture
Rik
Rik le 22 Juin 2021
For general advice and examples for how to create a GUI (and avoid using GUIDE), have look at this thread.

Connectez-vous pour commenter.

Réponses (1)

Vimal Rathod
Vimal Rathod le 22 Juin 2021
Hi,
you could get the handle of the GUI element specific to the tag using the following code.
h = findobj('Tag','axes5')
Refer to the following link to know more about findobj function.
  1 commentaire
Walter Roberson
Walter Roberson le 22 Juin 2021
If a graphics object with the tag axes5 existed after the GUI was loaded from the fig file and all of the CreateFcn have been run, then GUIDE would automatically have created handles.axes5 .
It is possible that someone has been careless about updating the handles struct, and so in theory it could be the case that a line of code has accidentally removed handles.axes5 from handles. However, in my experience it is much more likely that in this situation, there is no object with tag 'axes5'
Exception: trying to manage two distinct GUIDE guis from the same GUI can lead to this situation. The handles structure belongs to the figure, so if you have a callback on a second figure, GUIDE would invoke the callback with whatever handles are stored for the second figure instead of for the first figure.
... But most of the time, the axes was either deleted by the user in GUIDE, or else the axes has a slightly different name than expected, or else the user made a mistake in the thinking about which axes was involved.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by