indrani - it sounds like you have one push button that reads in an image (and does something with it), and another push button that will then convert that image into a binary image. If the problem is how to allow the second push button function to access that image, then what you can do is to save the image to the handles structure so that all callbacks have access to this image. For example,
function readimage_Callback(hObject, eventdata, handles)
[filename,pathname,filterindex] = uigetfile();
handles.myImage = imread(fullfile(pathname, filename));
guidata(hObject, handles);
Then, in your other callback, you would access this image as
function process_Callback(hObject, eventdata, handles)
if isfield(handles, 'myImage')
myImage = handles.myImage;
end
In the first callback, we load the image (I'm not sure how you are doing this so the code presented here will be different). We call guidata to update the handles structure with the myImage field. In the second callback, we check for existence of the image field and then use it as needed.
Best Answer