Skip to content
Snippets Groups Projects

Add Toolbox Information to config implements #33

Merged Lemmer, Jan requested to merge dev/DocForPreRelease into development
4 files
+ 49
37
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 28
17
@@ -69,27 +69,12 @@ else
end
disp(['publishing of ', ID, ' started']);
%% Create a Copy of the script, config and user functions(optional)
%% Create a Copy of the script and user functions(optional)
% script
PlotID.createFileCopy({[DataPaths.script,'.m']},folderName,storPath,ID, 'script');
% config
[fList,pList] = matlab.codetools.requiredFilesAndProducts(DataPaths.script);
if ~configError %config File must exist
% copy config file
configPath = PlotID.createFileCopy('config.json',folderName,...
storPath,ID, 'data');
% add Metadata
config.MatlabVersion = version;
% TODO Add Toolboxes
%write config
fid = fopen(char(configPath),'w');
txt = jsonencode(config,'PrettyPrint',true);
fprintf(fid,txt);
fclose(fid);
end
% user functions
[fList,pList] = matlab.codetools.requiredFilesAndProducts(DataPaths.script);
if options.CopyUserFCN
fList = fList(~ismember(fList,[DataPaths.script,'.m'])); % rmv script from list
fList = fList(~contains(fList,'config.json')); % rmv config.json from list
@@ -146,6 +131,32 @@ switch options.Method
% Create a copy of the research data
PlotID.createFileCopy(DataPaths.rdata,folderName,storPath,ID, 'data');
end
%% Write Config File
if ~configError %config File must exist
% copy config file
configPath = PlotID.createFileCopy('config.json',folderName,...
storPath,ID, 'data');
else
configPath = fullpath(storPath,folderName, 'config.json');
config = struct();
if ispc
config.author = getenv('USERNAME');
end
end
% add further Metadata
config.ProjectID = ID;
config.CreationDate = datestr(now);
config.MatlabVersion = version;
config.ToolboxVersions = pList;
%write config
fid = fopen(char(configPath),'w');
txt = jsonencode(config,'PrettyPrint',true);
fprintf(fid,txt);
fclose(fid);
%% Export the Plot
try
PlotName = [ID,'_plot']; % plotname
Loading