/[MITgcm]/MITgcm/utils/matlab/rdmds.m
ViewVC logotype

Diff of /MITgcm/utils/matlab/rdmds.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.8 by adcroft, Mon Sep 10 14:09:42 2001 UTC revision 1.9 by adcroft, Wed Nov 21 17:56:01 2001 UTC
# Line 73  for ind=1:size(varargin,2); Line 73  for ind=1:size(varargin,2);
73    if arg>=9999999999    if arg>=9999999999
74     error(sprintf('Argument %i > 9999999999',arg))     error(sprintf('Argument %i > 9999999999',arg))
75    end    end
76    if prod(arg>=0) & prod(round(arg)==arg)    if isnan(arg)
77       iters=scanforfiles(fname);
78      elseif prod(arg>=0) & prod(round(arg)==arg)
79     iters=arg;     iters=arg;
80    else    else
81     error(sprintf('Argument %i must be a positive integer',arg))     error(sprintf('Argument %i must be a positive integer',arg))
# Line 100  allfiles=dir( sprintf('%s*.meta',fname) Line 102  allfiles=dir( sprintf('%s*.meta',fname)
102    
103  if size(allfiles,1)==0  if size(allfiles,1)==0
104   disp(sprintf('No files match the search: %s.*.meta',fname));   disp(sprintf('No files match the search: %s.*.meta',fname));
105   error('No files found.')  %allow partial reads%  error('No files found.')
106  end  end
107    
108  % Loop through allfiles  % Loop through allfiles
# Line 329  if count ~= nnn Line 331  if count ~= nnn
331  end  end
332  st=fclose(fid);  st=fclose(fid);
333  arr=reshape(arr,N);  arr=reshape(arr,N);
334    
335    %
336    function [iters] = scanforfiles(fname)
337    
338    allfiles=dir([fname '.*.meta']);
339    for k=1:size(allfiles,1);
340     hh=allfiles(k).name;
341     iters(k)=str2num( hh(end-14:end-5) );
342    end
343    
344    disp([ sprintf('Reading %i time levels:',size(allfiles,1)) sprintf(' %i',iters) ]);

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.22