打开文件为空自动返回 matlab

来源:互联网 发布:淘宝上如何卖土特产 编辑:程序博客网 时间:2024/05/21 09:41
%choose image pathway
[filename, pathname]=...
     uigetfile({'*.jpg';'*.bmp';'*.gif'},'choose image pathway');
%combination and file name
str = [pathname filename];
if (filename~=0)                          
%read image
im=imread(str);          
%show picture
imshow(im,'parent',h_axes1)
set(0,'UserData',im)
else                                                    %empty file
   clear;
end
原创粉丝点击