dxwwangyan 发表于 2006-4-6 10:15

[求助]判断文件格式时出错

<P>  读入一个图像文件后,进行了文件格式的判断,结果出错,请大家帮我看看问题出在哪,谢谢!<BR>具体代码和出错信息如下:<BR>=uigetfile(...<BR>{'*.bmp;*.jpg;*.tif;*.png','IMAGE Files (*.bmp,*.jpg,*.tif,*.png)';<BR>   '*.bmp','Bitmap (*.bmp)'; ...<BR>   '*.jpg','Joint Photographic Experts Group (*.jpg)'; ...<BR>   '*.tif','Tagged Image files (*.tif)'; ...<BR>   '*.png','Portable Network Graphics (*.png)'; ...<BR>   '*.*','All Files (*.*)'},...<BR>   'File Selector','')<BR>x1=imread(FileName);<BR>h_axes=axes('position',,'visible','on'); <BR>imshow(x1)<BR>info=imfinfo(FileName);<BR>if (info.ColorType=='truecolor'|info.ColorType=='indexed')<BR> h1 = uicontrol(gcf, ... <BR> 'style','pushbutton',...<BR> 'Callback','changeformat', ... <BR> 'Position',, ... <BR> 'String','格式转换', ... <BR> 'Tag','Pushchange');<BR>end<BR>出错信息:<BR>??? Error using ==&gt; eq<BR>Array dimensions must match for binary array op.</P>
<P>Error in ==&gt; open at 60<BR>if info.ColorType=='truecolor'</P>
<P>??? Error while evaluating uicontrol Callback.</P>

happy 发表于 2006-4-6 10:52

回复:(dxwwangyan)[求助]判断文件格式时出错

应该是uicontrol有问题,仔细看看帮助

dxwwangyan 发表于 2006-4-6 17:15

happy教授,如果我把代码中的判断语句注释掉,就不提示出错。另外:<BR>??? Error using ==&gt; eq<BR>Array dimensions must match for binary array op.<BR>这是什么意思啊,我这段代码中并没用到eq啊,请教授指教,谢谢!

happy 发表于 2006-4-6 20:12

回复:(dxwwangyan)[求助]判断文件格式时出错

你试一下吧判断语句if (info.ColorType=='truecolor'|info.ColorType=='indexed')改成<BR>coltype=info.ColorType<BR>if(coltype=='truecolor'|coltype=='indexed')看看

dxwwangyan 发表于 2006-4-7 11:48

回复:(dxwwangyan)[求助]判断文件格式时出错

<P>教授,我试了,还是同样的错误。</P>
页: [1]
查看完整版本: [求助]判断文件格式时出错