Effacer les filtres
Effacer les filtres

Undefined function or variable 'im'.

1 vue (au cours des 30 derniers jours)
Hazel Sialongo
Hazel Sialongo le 24 Sep 2016
Commenté : Image Analyst le 24 Sep 2016
Also I got error for " imM=im>80;" in pushbutton2 function
Code:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
[fname path]=uigetfile('*.jpg');
fname=strcat(path,fname);
im=imread(fname);
im=rgb2gray(im);
axes(handles.axes1)
imshow(im);
title('Grayscale Iris Image');
% --- Executes on button press in pushbutton2. function pushbutton2_Callback(hObject, eventdata,handles)
imM=im>80;
axes(handles.axes2)
imshow(imM);
title('Threshold Image');

Réponse acceptée

Image Analyst
Image Analyst le 24 Sep 2016
I answered this already in your other question. Basically, see the FAQ http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F to see a variety of ways how you can get "im" into that function.
  3 commentaires
Hazel Sialongo
Hazel Sialongo le 24 Sep 2016
By the way, thank you for helping me solving my first problem.
Image Analyst
Image Analyst le 24 Sep 2016
I guess you didn't want to read the FAQ, or didn't understand it. If you didn't understand it, probably the simplest approach for you is to simply put
global im;
as the first line of every function where you expect to use im. Just be aware that if you change it in any function, it's global so it will change in all functions from that point in time onwards. Functions that have that global line will see im, and functions that don't have that line won't see im.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Introduction to Installation and Licensing 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