0001 function struct=read_file(name,whole);
0002
0003
0004
0005
0006
0007 fid=fopen(name,'r');
0008 i=0;
0009 while (~feof(fid)),
0010 i=i+1;
0011 A=readline(fid,2);
0012 A=readline(fid,2);
0013 A=readline(fid,4);
0014 [A,bytecount]=fscanf(fid,'%i %f',[1 2]);
0015 if whole==1,
0016 struct(i).nods=A(1);
0017 else
0018 struct(i).nods=A(1)-1;
0019 end
0020 A=readline(fid,5);
0021
0022 struct(i).x=zeros(struct(i).nods,1);
0023 struct(i).y=zeros(struct(i).nods,1);
0024
0025 for n=1:struct(i).nods,
0026 [A,bytecount]=fscanf(fid,'%f %f',[1 2]);
0027 struct(i).x(n)=A(1);
0028 struct(i).y(n)=A(2);
0029 end
0030 if whole==0,
0031 fscanf(fid,'%f %f',[1 2]);
0032 end
0033
0034 end
0035 fclose(fid);
0036
0037
0038
0039
0040
0041
0042