0001 function savemedit(node,face,elem,fname)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 fid=fopen(fname,'wt');
0020 if(fid==-1)
0021 error('You do not have permission to save mesh files.');
0022 end
0023
0024 fprintf(fid,'# Generated by iso2mesh: http://iso2mesh.sf.net\n');
0025 fprintf(fid,'MeshVersionFormatted\t1\nDimension\t3\n');
0026
0027 if(~isempty(node))
0028 if(size(node,2)<=3) node(1,4)=0; end
0029 fprintf(fid,'Vertices\t%d\n',size(node,1));
0030 fprintf(fid,'%e\t%e\t%e\t%.0f\n',node(:,1:4)');
0031 end
0032
0033 if(~isempty(face))
0034 if(size(face,2)<=3) face(1,4)=0; end
0035 fprintf(fid,'Triangles\t%d\n',size(face,1));
0036 fprintf(fid,'%d\t%d\t%d\t%d\n',face(:,1:4)');
0037 end
0038
0039 if(~isempty(elem))
0040 if(size(elem,2)<=4) elem(1,5)=0; end
0041 fprintf(fid,'Tetrahedra\t%d\n',size(elem,1));
0042 fprintf(fid,'%d\t%d\t%d\t%d\t%d\n',elem(:,1:5)');
0043 end
0044
0045 fprintf(fid,'End');
0046
0047 fclose(fid);