expgen

PURPOSE ^

EXPGEN - create an Argus file from x and y arrays

SYNOPSIS ^

function expgen(file_name,contours,close_flag);

DESCRIPTION ^

EXPGEN - create an Argus file from x and y arrays

   Create .exp domain outline type out of x,y  coordinates. 
   The contour defined by arrays x and y should not be closed. 
   Generated domain outline will not be closed, except if close_flag is set to 1.

   Usage:
      expgen(file_name,contours,close_flag)

   See also EXPMASTER, EXPDOC

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function expgen(file_name,contours,close_flag);
0002 %EXPGEN - create an Argus file from x and y arrays
0003 %
0004 %   Create .exp domain outline type out of x,y  coordinates.
0005 %   The contour defined by arrays x and y should not be closed.
0006 %   Generated domain outline will not be closed, except if close_flag is set to 1.
0007 %
0008 %   Usage:
0009 %      expgen(file_name,contours,close_flag)
0010 %
0011 %   See also EXPMASTER, EXPDOC
0012 
0013 %Check on inputs
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     %get density for this profile.
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);

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003