1 |
gmaze |
1.1 |
% |
2 |
|
|
% LIST = get_plotlist(MASTER,SUBDIR) |
3 |
|
|
% |
4 |
|
|
% This function determines the list of pre-defined plots |
5 |
|
|
% available with the MASTER.m in the folder SUBDIR |
6 |
|
|
% LIST is a structure with name and description of each modules. |
7 |
|
|
% |
8 |
|
|
|
9 |
|
|
function LIST = get_plotlist(MASTER,SUBDIR) |
10 |
|
|
|
11 |
|
|
global sla |
12 |
|
|
|
13 |
|
|
% Define suffixe of plot module: |
14 |
|
|
suff = '_pl'; |
15 |
|
|
|
16 |
|
|
d = dir(strcat(SUBDIR,sla)); |
17 |
|
|
|
18 |
|
|
ii = 0; |
19 |
|
|
% Select Matlab files: |
20 |
|
|
for id = 1 : length(d) |
21 |
|
|
en = length( d(id).name ); |
22 |
|
|
if en~=1 & (d(id).name(en-1:en) == '.m') & ~d(id).isdir |
23 |
|
|
ii = ii + 1; |
24 |
|
|
l(ii).name = d(id).name; |
25 |
|
|
end |
26 |
|
|
end |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
% Select Matlab files with MASTER as prefix |
30 |
|
|
ii = 0; |
31 |
|
|
|
32 |
|
|
for il = 1 : size(l,2) |
33 |
|
|
fil = l(il).name; |
34 |
|
|
pref = strcat(MASTER,suff); |
35 |
|
|
iM = findstr( strcat(SUBDIR,sla,fil) , pref ) ; |
36 |
|
|
|
37 |
|
|
if ~isempty(iM) |
38 |
|
|
ii = ii + 1; |
39 |
|
|
LIST(ii).name = l(il).name; |
40 |
gmaze |
1.2 |
LIST(ii).index = ii; |
41 |
gmaze |
1.1 |
|
42 |
|
|
% Recup description of plot module: |
43 |
|
|
fid = fopen(strcat(SUBDIR,sla,fil)); |
44 |
|
|
thatsit = 0; |
45 |
|
|
while thatsit ~= 1 |
46 |
|
|
tline = fgetl(fid); |
47 |
|
|
if tline ~= -1 |
48 |
|
|
if length(tline)>4 & tline(1:4) == '%DEF' |
49 |
|
|
LIST(ii).description = tline(5:end); |
50 |
|
|
thatsit = 1; |
51 |
|
|
end %if |
52 |
|
|
else |
53 |
|
|
LIST(ii).description = 'Not found'; |
54 |
|
|
thatsit = 1; |
55 |
|
|
end %if |
56 |
|
|
end %while |
57 |
|
|
|
58 |
|
|
end %if |
59 |
|
|
|
60 |
|
|
end %for il |
61 |
|
|
|
62 |
|
|
if ~exist('LIST') |
63 |
|
|
LIST= NaN; |
64 |
|
|
end |