-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdata_load.m
24 lines (24 loc) · 1.23 KB
/
data_load.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function metric = data_load(metric, dicefg_disp)
[filePath,fileName,fileExt] = fileparts(metric.ResourceDataFile);
if strcmpi(fileExt,'.mat')
dicefg_disp(1,'Loading resource data (mat format).');
loadedCell = load(metric.ResourceDataFile,'resdata'); metric.ResData=loadedCell.resdata;
loadedCell = load(metric.SystemDataFile,'sysdata'); metric.SysData=loadedCell.sysdata;
loadedCell = load(metric.ResourceClassList,'classes'); metric.ResClassList=loadedCell.resclasses;
loadedCell = load(metric.ResourceList,'resources'); metric.ResList=loadedCell.resources;
elseif strcmpi(fileExt,'.json')
dicefg_disp(1,'Loading resource data (JSON format).');
fileName = strrep(fileName,'-resdata','');
[metric.ResData,metric.SysData,metric.ResList,metric.ResClassList]=json2fg(filePath,fileName);
else
error('Only .mat data files are supported in the current version.')
exit
end
metric.('NumResources') = length(metric.ResList);
metric.('NumClasses') = length(metric.ResClassList);
% switch metric.Technology
% case 'agnostic'
% dicefg_disp(2,'Running in technology-agnostic mode.')
% end
dicefg_disp(2,sprintf('Dataset has %d resources and %d classes.',metric.NumResources,metric.NumClasses));
end