1 |
gforget |
1.1 |
function [meta]=rdmds_meta(fileName); |
2 |
|
|
|
3 |
|
|
%read meta file |
4 |
|
|
tmp1=dir([fileName '*.meta']); tmp1=tmp1(1).name; |
5 |
|
|
tmp2=strfind(fileName,filesep); |
6 |
|
|
if ~isempty(tmp2); tmp2=tmp2(end); else; tmp2=0; end; |
7 |
|
|
tmp1=[fileName(1:tmp2) tmp1]; fid=fopen(tmp1); |
8 |
|
|
while 1; |
9 |
|
|
tline = fgetl(fid); |
10 |
|
|
if ~ischar(tline), break, end |
11 |
|
|
if isempty(whos('tmp3')); tmp3=tline; else; tmp3=[tmp3 ' ' tline]; end; |
12 |
|
|
end |
13 |
|
|
fclose(fid); |
14 |
|
|
|
15 |
|
|
%add meta variables to workspace |
16 |
|
|
eval(tmp3); |
17 |
|
|
|
18 |
|
|
%reformat to meta structure |
19 |
|
|
meta.dataprec=dataprec; |
20 |
|
|
meta.nDims=nDims; |
21 |
|
|
meta.nFlds=nFlds; |
22 |
|
|
meta.nrecords=nrecords; |
23 |
|
|
meta.fldList=fldList; |
24 |
|
|
meta.dimList=dimList; |
25 |
|
|
if ~isempty(who('timeInterval')); meta.timeInterval=timeInterval; end; |
26 |
|
|
if ~isempty(who('timeStepNumber')); meta.timeStepNumber=timeStepNumber; end; |
27 |
|
|
|