MATLAB: How can i change normal image to grayscale from menu editor gui

matlab gui

[Filename,Pathname]=uigetfile({'*.jpg';'*.png'}, 'File Selector');
name=strcat(Pathname,Filename);
a=imread(name);
imshow(a);
……..
this is to open file but i want to rgb2gray from this coding. how can i do? thank you for helping. im using menu editor gui and for rgb2gray that is another menu callback

Best Answer

[Filename,Pathname]=uigetfile({'*.jpg';'*.png'}, 'File Selector');
name=strcat(Pathname,Filename);
a=rgb2gray(imread(name));
imshow(a);