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

Contents of /MITgcm/utils/matlab/grepread.m

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


Revision 1.1.4.1 - (show annotations) (download)
Wed Feb 6 15:48:10 2002 UTC (19 years, 7 months ago) by heimbach
Branch: ecco-branch
CVS Tags: ecco_c50_e32, ecco_c50_e33, ecco_c50_e30, ecco_c50_e31, ecco_c51_e34d, ecco_c51_e34e, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, icebear5, icebear4, icebear3, icebear2, ecco_c50_e29, ecco_c50_e28, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, ecco_c50_e33a, ecco_c51_e34, ecco_ice2, ecco_ice1, ecco_c44_e22, ecco_c44_e25, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5
Branch point for: c24_e25_ice, icebear
Changes since 1.1: +1 -1 lines
Updating ecco-branch-mod1 to checkpoint44.
Will be tagged ecco-branch-mod2.

1 function [vals] = grepread(file,varargin)
2 % VALS = GREPREAD(FILE,EXPR1,...);
3 %
4 % Extracts the expressions "expr1","expr2",... from the file "file".
5 % This assumes output in the standard form defined by the MITgcm
6 % monitor package and is not a replacement for TEXTREAD.
7 %
8 % e.g.
9 % >> vals=grepread('output.txt','time_secondsf','ke_mean','ke_max');
10 % >> plot(vals(:,1)/86400,vals(:,2:3));
11
12 if nargin<2
13 error('You must supply a filename and at least one search expression!')
14 end
15
16 tfile=sprintf('/tmp/grepexpr%15.15f',rand);
17 for k=1:nargin-1;
18 try
19 eval(['!grep ' varargin{k} ' ' file ' | sed s/.\*=// | sed s/NAN/1.23456789/ >! ' tfile])
20 vals(:,k)=textread(tfile,'%f');
21 delete(tfile)
22 catch
23 delete(tfile)
24 error(sprintf('An error occured while scanning for: %s',varargin{k}));
25 end
26 end

  ViewVC Help
Powered by ViewVC 1.1.22