1 |
% |
2 |
% get_plotlistdef(MASTER,SUBDIR) |
3 |
% |
4 |
% This function display description of pre-defined plots |
5 |
% available with the MASTER.m in the folder SUBDIR |
6 |
% |
7 |
% 07/12/06 |
8 |
% gmaze@mit.edu |
9 |
|
10 |
function LIST = get_plotlistdef(MASTER,SUBDIR) |
11 |
|
12 |
global sla |
13 |
|
14 |
% Define suffixe of plot 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 description of plot module: |
42 |
fid = fopen(strcat(SUBDIR,sla,fil)); |
43 |
thatsit = 0; |
44 |
while thatsit ~= 1 |
45 |
tline = fgetl(fid); |
46 |
if tline ~= -1 |
47 |
if length(tline)>4 & tline(1:4) == '%DEF' |
48 |
LIST(ii).description = tline(5:end); |
49 |
thatsit = 1; |
50 |
end %if |
51 |
else |
52 |
LIST(ii).description = 'Not found'; |
53 |
thatsit = 1; |
54 |
end %if |
55 |
end %while |
56 |
disp(strcat( num2str(LIST(ii).index),': Module extension :',fil(length(MASTER)+2:end-2))); |
57 |
disp(strcat('|-----> description :' , LIST(ii).description )); |
58 |
disp(char(2)) |
59 |
|
60 |
end %if |
61 |
|
62 |
end %for il |
63 |
|
64 |
if ~exist('LIST') |
65 |
LIST= NaN; |
66 |
end |
67 |
|