forked from IMFS-MMB/epi-mmb-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunionvariable.m
More file actions
30 lines (26 loc) · 822 Bytes
/
unionvariable.m
File metadata and controls
30 lines (26 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function unionvariablelist = unionvariable(model_list,rootdir)
for iii =1:length(model_list)
modelName = model_list{iii};
cd models
eval(strcat("cd ",modelName,";" ))
fname = strcat(modelName,".json");
fid = fopen(fname);
raw = fread(fid,inf);
str = char(raw');
fclose(fid);
jcode = jsondecode(str);
allvarnames_tmp = convertCharsToStrings(jcode.variables);
% %% To check if there are some typos in the json file in case spoted
% check1=ismember("Susceptible",allvarnames_tmp);
%
% if check1 ==1
% modelName
% display("Susceptible is in the list")
% end
if iii == 1
allvarnames = allvarnames_tmp;
end
allvarnames = union(allvarnames,allvarnames_tmp);
cd(rootdir)
end
unionvariablelist = allvarnames;