Revision 495
(checked in by cbc, 12 years ago)
|
Initial import of Stark code.
|
Line | |
---|
1 |
% [x,y,inbe,gridname]=read_bel(fname) |
---|
2 |
% |
---|
3 |
function [x,y,inbe,gridname]=read_bel(fname) |
---|
4 |
% |
---|
5 |
%Uses GUI interface is no parameter fame is not sent |
---|
6 |
if ~exist('fname') |
---|
7 |
[fname,fpath]=uigetfile('*.???','Which file?'); |
---|
8 |
if fname==0,return,end |
---|
9 |
else |
---|
10 |
fpath=[]; |
---|
11 |
end |
---|
12 |
% |
---|
13 |
% Open and read .bel file |
---|
14 |
[pfid,message]=fopen(fname); |
---|
15 |
if pfid==-1 |
---|
16 |
error([fpath fname,' not found. ',message]); |
---|
17 |
end |
---|
18 |
% read grid name from top of file |
---|
19 |
gridname=fgetl(pfid); |
---|
20 |
gridname=blank(gridname); |
---|
21 |
%gridname |
---|
22 |
% read header |
---|
23 |
header=fgets(pfid); |
---|
24 |
%header |
---|
25 |
% read incidence list |
---|
26 |
inbe=fscanf(pfid,'%f',[5 inf])'; |
---|
27 |
fclose(pfid); |
---|
28 |
% |
---|
29 |
% Open and read associated .nod file |
---|
30 |
% |
---|
31 |
nodes=get_nodes(gridname);x=nodes(:,1);y=nodes(:,2); |
---|
32 |
return |
---|