/[MITgcm]/MITgcm_contrib/gmaze_pv/visu/get_plotlistfields.m
ViewVC logotype

Annotation of /MITgcm_contrib/gmaze_pv/visu/get_plotlistfields.m

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


Revision 1.1 - (hide annotations) (download)
Wed Sep 19 15:30:51 2007 UTC (17 years, 10 months ago) by gmaze
Branch: MAIN
CVS Tags: HEAD
General Update

1 gmaze 1.1 %
2     % get_plotlistfields(MASTER,SUBDIR)
3     %
4     % This function returns the list of fields required by
5     % the modules of MASTER file in SUBDIR
6     %
7     % 06/05/2007
8     % gmaze@mit.edu
9    
10     function LIST = get_plotlistfields(MASTER,SUBDIR)
11    
12     global sla
13    
14     % Define suffixe of module:
15     suff = '_pl';
16    
17    
18     d = dir(SUBDIR);
19     ii = 0;
20     % Select Matlab files:
21     for id = 1 : length(d)
22     en = length( d(id).name );
23     if en~=1 & (d(id).name(en-1:en) == '.m') & ~d(id).isdir
24     ii = ii + 1;
25     l(ii).name = d(id).name;
26     end
27     end
28    
29     % Select Matlab files with MASTER as prefix
30     ii = 0;
31     for il = 1 : length(l)
32     fil = l(il).name;
33     pref = strcat(MASTER,suff);
34     iM = findstr( strcat(SUBDIR,sla,fil) , pref );
35    
36     if ~isempty(iM)
37     ii = ii + 1;
38     LIST(ii).name = l(il).name;
39     LIST(ii).index = ii;
40    
41     % Recup list of fields required by the module:
42     fid = fopen(strcat(SUBDIR,sla,fil));
43     thatsit = 0;
44     clear fiel
45     while thatsit ~= 1
46     tline = fgetl(fid);
47     if tline ~= -1
48     if length(tline)>4 & tline(1:4) == '%REQ'
49     tl = strtrim(tline(5:end));
50     if strmatch(';',tl(end)), tl = tl(1:end-1);end
51     tl = [';' tl ';'];
52     pv = strmatch(';',tl');
53     for ifield = 1 : length(pv)-1
54     fiel(ifield).name = tl(pv(ifield)+1:pv(ifield+1)-1);
55     end
56     LIST(ii).nbfields = size(fiel,2);
57     LIST(ii).required = fiel;
58     thatsit = 1;
59     end %if
60     else
61     fiel.name = 'Not found';
62     LIST(ii).required = fiel;
63     thatsit = 1;
64     end %if
65     end %while
66     %disp(strcat( num2str(LIST(ii).index),': Module extension :',fil(length(MASTER)+2:end-2)));
67     %disp(strcat('|-----> description :' , LIST(ii).description ));
68     %disp(char(2))
69    
70     end %if
71    
72     end %for il
73    
74     if ~exist('LIST')
75     LIST= NaN;
76     end
77    

  ViewVC Help
Powered by ViewVC 1.1.22