0001 function savedxf(node,face,elem,fname)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 if(nargin==2)
0020 fname=face;
0021 face=[];
0022 elem=[];
0023 end
0024
0025 if(nargin==3)
0026 fname=elem;
0027 elem=[];
0028 end
0029
0030 fid=fopen(fname,'wt');
0031 if(fid==-1)
0032 error('You do not have permission to save mesh files.');
0033 end
0034
0035 fprintf(fid,'0\nSECTION\n2\nHEADER\n0\nENDSEC\n0\nSECTION\n2\nENTITIES\n');
0036
0037 if(~isempty(face))
0038 fprintf(fid,'0\nPOLYLINE\n66\n1\n8\nI2M\n70\n64\n71\n%d\n72\n%d\n',size(node,1),size(face,1));
0039 end
0040
0041 if(~isempty(node))
0042 node=node(:,1:3);
0043 fprintf(fid,'0\nVERTEX\n8\nI2M\n10\n%.16f\n20\n%.16f\n30\n%.16f\n70\n192\n',node');
0044 end
0045
0046 if(~isempty(face))
0047 face=face(:,1:3);
0048 fprintf(fid,'0\nVERTEX\n8\nI2M\n62\n254\n10\n0.0\n20\n0.0\n30\n0.0\n70\n128\n71\n%d\n72\n%d\n73\n%d\n',face');
0049 end
0050
0051 fprintf(fid,'0\nSEQEND\n0\nENDSEC\n');
0052
0053 if(~isempty(face))
0054 fprintf(fid,'0\nSECTION\n2\nENTITIES\n0\nINSERT\n8\n1\n2\nMesh\n10\n0.0\n20\n0.0\n30\n0.0\n41\n1.0\n42\n1.0\n43\n1.0\n50\n0.0\n0\nENDSEC\n');
0055 end
0056
0057 fprintf(fid,'0\nEOF');
0058
0059 fclose(fid);