Hello! I am building an interface with GUI. By using a pushing bottom I open a figure, and by pushing a second one, I add a filter to the figure in another axes. However, Matlab gives me an error in the second function: the figure does not exits. How can I call the figure in the second function by pushing botoom 2? This is my code:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename pathname]=uigetfile({'*.jpg'}, 'File Selector');fullpathname=strcat(pathname, filename);image=imread(fullpathname); figure.handle=imread(image);set(handles.text2, 'String', pathname);handles.axes1=imshow(image);set(handles.axes1, imshow(image));% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)filter=1-image; axes(handles.axes2);imshow(filter);set(handles.axes2, imshow(filter)
Best Answer