/[MITgcm]/MITgcm_contrib/mitgcm_tools/mitgcmhistory.m
ViewVC logotype

Annotation of /MITgcm_contrib/mitgcm_tools/mitgcmhistory.m

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


Revision 1.2 - (hide annotations) (download)
Sun Dec 2 05:45:51 2007 UTC (16 years, 5 months ago) by dimitri
Branch: MAIN
Changes since 1.1: +1 -1 lines
removed "!" for bash compatibility

1 adcroft 1.1 function [vals] = mitgcmhistory(file,varargin)
2     %vals = mitgcmhistory(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=mitgcmhistory('output.txt','time_secondsf','ke_mean','ke_max');
10     %>> plot(vals(:,1)/86400,vals(:,2:3));
11     %
12     % Written by adcroft@mit.edu, 2001
13     %$Header:
14    
15     if nargin<2
16     error('You must supply a filename and at least one search expression!')
17     end
18    
19     tfile=sprintf('/tmp/grepexpr%15.15f',rand);
20     for k=1:nargin-1;
21     try
22 dimitri 1.2 eval(['!grep ' varargin{k} ' ' file ' | sed s/.\*=// | sed s/NAN/1.23456789/ > ' tfile])
23 adcroft 1.1 vals(:,k)=textread(tfile,'%f');
24     delete(tfile)
25     catch
26     delete(tfile)
27     error(sprintf('An error occured while scanning for: %s',varargin{k}));
28     end
29     end

  ViewVC Help
Powered by ViewVC 1.1.22