Home > vbmeg > external > iso2mesh > readmedit.m

readmedit

PURPOSE ^

SYNOPSIS ^

function [node,elem,face]=readmedit(filename)

DESCRIPTION ^

 [node,elem,face]=readmedit(filename)

 read Medit mesh format

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    fname: name of the medit data file

 output:
    node: node coordinates of the mesh
    elem: list of elements of the mesh        
    face: list of surface triangles of the mesh        

 -- 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 [node,elem,face]=readmedit(filename)
0002 %
0003 % [node,elem,face]=readmedit(filename)
0004 %
0005 % read Medit mesh format
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 %
0009 % input:
0010 %    fname: name of the medit data file
0011 %
0012 % output:
0013 %    node: node coordinates of the mesh
0014 %    elem: list of elements of the mesh
0015 %    face: list of surface triangles of the mesh
0016 %
0017 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0018 %
0019 
0020 node=[];
0021 elem=[];
0022 face=[];
0023 fid=fopen(filename,'rt');
0024 while(~feof(fid))
0025     key=fscanf(fid,'%s',1);
0026     if(strcmp(key,'End')) break; end
0027     val=fscanf(fid,'%d',1);
0028     if(strcmp(key,'Vertices'))
0029         node=fscanf(fid,'%f',4*val);
0030         node=reshape(node,[4 val])';
0031     elseif(strcmp(key,'Triangles'))
0032         face=fscanf(fid,'%d',4*val);
0033         face=reshape(face,[4 val])';
0034     elseif(strcmp(key,'Tetrahedra'))
0035         elem=fscanf(fid,'%d',5*val);
0036         elem=reshape(elem,[5 val])';        
0037     end
0038 end
0039 fclose(fid);

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