MATLAB: How can i convert rgb to grayscale after browes image

convertMATLABrgb2gray

global a
[filename pathname] = uigetfile({'*.jpg';'*.bmp'},'File Selector');
image = strcat(pathname, filename);
axes(handles.axes1);
imshow(image)
set(handles.edit1,'string',filename);
set(handles.edit2,'string',image);
%after this code i can convert this browesd image to grayscale plz help

Best Answer

Please change the image variable name to another to avoid conflict issue.
rgb2gray(image1)
??
[filename pathname] = uigetfile({'*.jpg';'*.bmp'},'File Selector');
image1= strcat(pathname, filename);
image_gray=rgb2gray(image1)
% Next do