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

Annotation of /MITgcm_contrib/mitgcm_tools/grepparameter.m

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


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Thu Sep 25 13:42:11 2003 UTC (20 years, 7 months ago) by adcroft
Branch: adcroft, MAIN
CVS Tags: initial, HEAD
Changes since 1.1: +0 -0 lines
Checking in Adcroft's matlab scripts for posterity.

1 adcroft 1.1 function [parval] = grepparameter(datafile,str)
2     %parval=grepparameter(DATAFILE,STRING)
3     %
4     %Extracts a parameter value from the input parameter file (e.g. "data") based
5     %on a parameter name. e.g.
6     %>> tauxfile=grepparameter(datafile,'zonalwindfile');
7     %
8     %Written by adcroft@mit.edu, 2001
9     %$header
10    
11     Ltrue='true';
12     Lfalse='false';
13    
14     parval=[];
15     strc=evalc([ ...
16     '!fgrep -v "#" ' datafile ...
17     '| grep -i ''' str ''' - ' ...
18     '| tail -1 ' ...
19     '| sed ''s/.*=//'' ' ...
20     '| sed ''s/,.*/;/'' ' ...
21     '| sed ''s/\.[tT][rR][uU][eE]\./Ltrue/'' ' ...
22     '| sed ''s/\.[fF][aA][lL][sS][eE]\./Lfalse/'' ' ...
23     ]);
24     if ~isempty(strc)
25     eval([ 'parval=' strc ]);
26     end

  ViewVC Help
Powered by ViewVC 1.1.22