Home > vbmeg > external > iso2mesh > saveasc.m

saveasc

PURPOSE ^

SYNOPSIS ^

function saveasc(v,f,fname)

DESCRIPTION ^

 saveasc(v,f,fname)

 save a surface mesh to FreeSurfer ASC mesh format

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2009/04/02

 input:
      v: input, surface node list, dimension (nn,3)
      f: input, surface face element list, dimension (be,3)
      fname: output file name

 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function saveasc(v,f,fname)
0002 %
0003 % saveasc(v,f,fname)
0004 %
0005 % save a surface mesh to FreeSurfer ASC mesh format
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 % date: 2009/04/02
0009 %
0010 % input:
0011 %      v: input, surface node list, dimension (nn,3)
0012 %      f: input, surface face element list, dimension (be,3)
0013 %      fname: output file name
0014 %
0015 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0016 %
0017 
0018 fid=fopen(fname,'wt');
0019 if(fid==-1)
0020     error('You do not have permission to save mesh files.');
0021 end
0022 fprintf(fid,'#!ascii raw data file %s\n',fname);
0023 fprintf(fid,'%d %d\n',length(v),length(f));
0024 fprintf(fid,'%.16f %.16f %.16f 0\n',v');
0025 fprintf(fid,'%d %d %d 0\n',(f-1)');
0026 fclose(fid);

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005