我想在 matlab GUI 中的另一个函数中访问一个函数中变量的值。例如
% --- Executes on button press in browseCoverHide.
function browseCoverHide_Callback(hObject, eventdata, handles)
% hObject handle to browseCoverHide (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[File,Path] = uigetfile('*.png','Select Image');
path = strcat(Path,File);
global covImg
covImg = imread(path);
axes(handles.axes1);
imshow(covImg);
% --- Executes on button press in browseSecImg.
function browseSecImg_Callback(hObject, eventdata, handles)
% hObject handle to browseSecImg (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global covImg
axes(handles.axes3);
imshow(covImg);
在这里我想从中访问,CovImg
但它不起作用。function browseSecImg_Callback
function browseCoverHide_Callback