[filename,filepath,filterindex]=uigetfile(...
{'*.jpg;*.gif;*.tif;*.bmp','All Image Files(*.jpg,*.gif,*.tif,*.bmp)';
'*.jpg','JPG-files(*.jpg)';...
'*.gif','GIF-files(*.gif)';...
'*.tif','TIF-files(*.tif)';...
'*.bmp','BMP-files(*.bmp)';...
'*.*','All Image Files(*.*)'},...
'选择图像文件','untitled.jpg',...
'multiselect','off');
if isequal(filename,0)||isequal(filepath,0)
return;
else
filefullpath=fullfile(filepath,filename);
fimg=imread(filefullpath);
imshow(fimg);
end
这样就可以了,但是显示的gif图象是 黑白的