how i can use the value of a in other function?

1 Ansicht (letzte 30 Tage)
sana saleeme
sana saleeme am 1 Mai 2016
Kommentiert: sana saleeme am 2 Mai 2016
how i can use the value of a in other function? and my code is here.
function pushbutton1_Callback(hObject, eventdata, handles)
[a , b] = uigetfile({'*.*' , 'all files'});
imread(a);
imshow(a);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
v = imread(a);
bw = im2bw(a);
  1 Kommentar
sana saleeme
sana saleeme am 1 Mai 2016
i did it by using global.but now no function apply on a like im2bw and rgb2gray not working on it.please guide me what should a i do?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Jan
Jan am 1 Mai 2016
function pushbutton1_Callback(hObject, eventdata, handles)
[a , b] = uigetfile({'*.*' , 'all files'});
imread(a);
imshow(a);
handles.a = a;
guidata(hObject, handles);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
handles = guidata(hObject);
v = imread(handles.a);
bw = im2bw(handles.a);
Note: Better use absolute file names with path:
a = fullfile(b, a);

Weitere Antworten (1)

Image Analyst
Image Analyst am 1 Mai 2016

Kategorien

Mehr zu App Building finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by