4 |
% A = RDMDS(FNAME) |
% A = RDMDS(FNAME) |
5 |
% A = RDMDS(FNAME,ITER) |
% A = RDMDS(FNAME,ITER) |
6 |
% A = RDMDS(FNAME,[ITER1 ITER2 ...]) |
% A = RDMDS(FNAME,[ITER1 ITER2 ...]) |
7 |
|
% A = RDMDS(FNAME,NaN) |
8 |
|
% A = RDMDS(FNAME,Inf) |
9 |
|
% [A,ITS] = RDMDS(FNAME,[...]) |
10 |
% |
% |
11 |
% A = RDMDS(FNAME) reads data described by meta/data file format. |
% A = RDMDS(FNAME) reads data described by meta/data file format. |
12 |
% FNAME is a string containing the "head" of the file names. |
% FNAME is a string containing the "head" of the file names. |
33 |
% 10-digit iterartion number. |
% 10-digit iterartion number. |
34 |
% ITER is a vector of positive integers that will expand to the 10-digit |
% ITER is a vector of positive integers that will expand to the 10-digit |
35 |
% number in the file name. |
% number in the file name. |
36 |
|
% If ITER=NaN, all iterations will be read. |
37 |
|
% If ITER=Inf, the last (highest) iteration will be read. |
38 |
% |
% |
39 |
% eg. To repeat above operation |
% eg. To repeat above operation |
40 |
% >> A=rdmds('T',2880); |
% >> A=rdmds('T',2880); |
41 |
% eg. To read multiple time steps |
% eg. To read multiple time steps |
42 |
% >> A=rdmds('T',[0 1440 2880]); |
% >> A=rdmds('T',[0 1440 2880]); |
43 |
|
% eg. To read all time steps |
44 |
|
% >> [A,ITS]=rdmds('T',NaN); |
45 |
|
% eg. To read the last time step |
46 |
|
% >> [A,IT]=rdmds('T',Inf); |
47 |
% Note: this form can not read files with no iteration count in file name. |
% Note: this form can not read files with no iteration count in file name. |
48 |
% |
% |
49 |
% A = RDMDS(FNAME,MACHINEFORMAT) |
% A = RDMDS(FNAME,MACHINEFORMAT) |
54 |
% |
% |
55 |
% $Header$ |
% $Header$ |
56 |
|
|
57 |
|
AA=[]; |
58 |
|
iters=[]; |
59 |
|
|
60 |
% Default options |
% Default options |
61 |
ieee='b'; |
ieee='b'; |
62 |
fname=fnamearg; |
fname=fnamearg; |
121 |
allfiles=dir( sprintf('%s*.meta',fname) ); |
allfiles=dir( sprintf('%s*.meta',fname) ); |
122 |
|
|
123 |
if size(allfiles,1)==0 |
if size(allfiles,1)==0 |
124 |
disp(sprintf('No files match the search: %s.*.meta',fname)); |
disp(sprintf('No files match the search: %s*.meta',fname)); |
125 |
%allow partial reads% error('No files found.') |
%allow partial reads% error('No files found.') |
126 |
end |
end |
127 |
|
|
201 |
|
|
202 |
% This is a kludge to catch whether the meta-file is of the |
% This is a kludge to catch whether the meta-file is of the |
203 |
% old or new type. nrecords does not exist in the old type. |
% old or new type. nrecords does not exist in the old type. |
204 |
nrecords = -987; |
nrecords = NaN; |
205 |
|
|
206 |
% Everything in lower case |
% Everything in lower case |
207 |
allstr=lower(allstr); |
allstr=lower(allstr); |
213 |
eval(allstr); |
eval(allstr); |
214 |
|
|
215 |
N=reshape( dimlist , 3 , prod(size(dimlist))/3 ); |
N=reshape( dimlist , 3 , prod(size(dimlist))/3 ); |
216 |
if nrecords ~= -987 & nrecords > 1 |
if ~isnan(nrecords) & nrecords > 1 |
217 |
N=[N,[nrecords 1 nrecords]']; |
N=[N,[nrecords 1 nrecords]']; |
218 |
end |
end |
219 |
|
|
220 |
if nrecords == -987 |
if isnan(nrecords) |
221 |
% This is the old 'meta' method that used sequential access |
% This is the old 'meta' method that used sequential access |
222 |
|
|
223 |
A=allstr; |
A=allstr; |
367 |
hh=allfiles(k).name; |
hh=allfiles(k).name; |
368 |
iters(k)=str2num( hh(end-14-ioff:end-5-ioff) ); |
iters(k)=str2num( hh(end-14-ioff:end-5-ioff) ); |
369 |
end |
end |
370 |
|
iters=sort(iters); |