NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/IO_Functions/read_bel.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 function [inbe,gridname]=read_bel(fname)
2 %READ_BEL read a FEM domain .bel file
3 % READ_BEL reads a FEM domain .bel file (boundary element
4 % description file) and returns the boundary list.  See the
5 % "Dartmouth File Standards" document for details on the .bel
6 % file structure/contents.
7 %
8 % With no input arguments, READ_BEL enables a file browser with
9 % which the user can select a .bel file. 
10 %
11 % Input:  belname - .bel filename
12 %
13 % Output: inbe    - boundary element list matrix
14 %         gridname - FEM domain name found in .bel file
15 %
16 % Call as: [inbe,gridname]=read_bel(fname)
17 %
18 % Written by: Chris E. Naimie
19 % Modified by: Brian O. Blanton to more general useage. (Jan 99)
20
21 nargchk(0,1,nargin);
22
23 if ~exist('fname')
24    [fname,fpath]=uigetfile('*.bel','Which file?');
25    if fname==0,return,end
26 else
27    fpath=[];
28 end
29
30
31 % Open and read .bel file
32 [pfid,message]=fopen(fname);
33 if pfid==-1
34    error([fpath fname,' not found. ',message]);
35 end
36
37 %  read grid name from top of file
38 gridname=fgetl(pfid);
39 gridname=blank(gridname);
40
41 %  read header
42 header=fgets(pfid);
43
44 %  read incidence list
45 inbe=fscanf(pfid,'%f',[5 inf])';
46 fclose(pfid);
Note: See TracBrowser for help on using the browser.