MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 求助! (https://www.labfans.com/bbs/showthread.php?t=10557)

s3232913 2010-01-06 11:32

求助!
 
求教fgets与fgetl的区别和使用方法:

读取方法:
zf=fgetl(fid);%读取字符
node.n=fscanf(fid,'%d',1); %结构总结点数
zf=fgetl(fid);zf=fgetl(fid);%读取字符
node.coord=fscanf(fid,'%f',node.n*2);%结点坐标(先x(nd.n),后y(nd.n))

读取数据:
结点数
33
结点坐标
0 6 12 0 6 12 0 6 12 0 6 12 0 6 12 0 6 12 0 6 12 0 6 12 0 6 12 0 6 12 0 6 12
0 0 0 4 4 4 8 8 8 12 12 12 16 16 16 20 20 20 24 24 24 28 28 28 32 32 32 36 36 36 40 40 40
单元数
50
单元结点编码
1 2 3 4 5 4 5 6 7 8 7 8 9 10 11 10 11 12 13 14 13 14 15 16 17 16 17 18 19 20 19 20 21 22 23 22 23 24 25 26 25 26 27 28 29 28 29 30 31 32
4 5 6 5 6 7 8 9 8 9 10 11 12 11 12 13 14 15 14 15 16 17 18 17 18 19 20 21 20 21 22 23 24 23 24 25 26 27 26 27 28 29 30 29 30 31 32 33 32 33


[FONT="黑体"][SIZE="5"]那个fgetl可以改成fgets吗,如果改成fgets怎么改,还有为什么要用两次fgetl呢?[/SIZE][/FONT]


所有时间均为北京时间。现在的时间是 11:05

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