0001 function expgen(file_name,contours,close_flag);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if((close_flag~=0) & (close_flag~=1)),
0015 error('close flag must be 0 of 1');
0016 end
0017 fid=fopen(file_name,'wt');
0018
0019 for i=1:length(contours),
0020 if(length(contours(i).x)~=length(contours(i).y)),
0021 error('contours x and y coordinates must be of identical size');
0022 end
0023
0024
0025 if isfield(contours,'density'),
0026 density=contours(i).density;
0027 end
0028
0029 fprintf(fid,'%s\n','## Name:');
0030 fprintf(fid,'%s\n','## Icon:0');
0031 fprintf(fid,'%s\n','# Points Count Value');
0032 if(close_flag==0),
0033 fprintf(fid,'%i %i\n',length(contours(i).x),density);
0034 else
0035 fprintf(fid,'%i %i\n',length(contours(i).x)+1,density);
0036 end
0037 fprintf(fid,'%s\n','# X pos Y pos');
0038 for j=1:length(contours(i).x),
0039 fprintf(fid,'%f %f\n',contours(i).x(j),contours(i).y(j));
0040 end
0041
0042 if(close_flag==1),
0043 fprintf(fid,'%f %f\n',contours(i).x(1),contours(i).y(1));
0044 end
0045 fprintf(fid,'%s\n','');
0046 end
0047 fclose(fid);