MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   【求助】读取txt文档的问题 (https://www.labfans.com/bbs/showthread.php?t=638)

hhu_liyan 2007-07-29 21:25

【求助】读取txt文档的问题
 
想用matlab来读取一个txt文件,
有两个问题
[filename1,pathname1]=uigetfile(' *.txt','Pick a file for read');
fid1=fopen(strcat(pathname1,filename1),'rt');
if(fid1==-1);
msgbox('input File or Path is not correct',Warning','warn');
break;
end
a=3;
Data=fscanf(fid1,'%f',a);
fclose(fid1);

为什么会出现一个
[COLOR="Red"] Error: A BREAK statement appeared outside of a loop. Use RETURN instead.[/COLOR]

是不是if那句有问题啊

如果不用那句可以实现读取txt文件 但是只能是数据型的变量,我想读出的数据中还有其他类型的内容 如何实现 谢谢了
我的邮箱是[email protected] 如果在这里说不清楚的话 又乐意帮助我的话 请发个邮件过来 谢谢了

windzyf 2007-08-13 16:47

用 load 试试

elunxu 2007-12-24 09:56

在循环里使用fgetl函数


所有时间均为北京时间。现在的时间是 14:22

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.