Skip to content
Snippets Groups Projects
Commit 4a7b9ebe authored by Lemmer, Jan's avatar Lemmer, Jan
Browse files

Add Toolbox Information to config implements #33

Add additional Meta Data to config.json
Add behaviour when config.json is missing
parent d6a27af6
No related branches found
No related tags found
1 merge request!11Add Toolbox Information to config implements #33
Pipeline #564348 canceled
...@@ -69,27 +69,12 @@ else ...@@ -69,27 +69,12 @@ else
end end
disp(['publishing of ', ID, ' started']); 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 % script
PlotID.createFileCopy({[DataPaths.script,'.m']},folderName,storPath,ID, '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 % user functions
[fList,pList] = matlab.codetools.requiredFilesAndProducts(DataPaths.script);
if options.CopyUserFCN if options.CopyUserFCN
fList = fList(~ismember(fList,[DataPaths.script,'.m'])); % rmv script from list fList = fList(~ismember(fList,[DataPaths.script,'.m'])); % rmv script from list
fList = fList(~contains(fList,'config.json')); % rmv config.json from list fList = fList(~contains(fList,'config.json')); % rmv config.json from list
...@@ -146,6 +131,32 @@ switch options.Method ...@@ -146,6 +131,32 @@ switch options.Method
% Create a copy of the research data % Create a copy of the research data
PlotID.createFileCopy(DataPaths.rdata,folderName,storPath,ID, 'data'); PlotID.createFileCopy(DataPaths.rdata,folderName,storPath,ID, 'data');
end 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 %% Export the Plot
try try
PlotName = [ID,'_plot']; % plotname PlotName = [ID,'_plot']; % plotname
......
{ {
"Author": "Example Author"
"ProjectID": "AB01", "ProjectID": "AB01",
"ServerPath": "\\\\Server\\path\\folder" "ServerPath": "\\\\Server\\path\\folder"
} }
\ No newline at end of file
...@@ -43,7 +43,7 @@ h5write(fpath, "/y1", y1) ...@@ -43,7 +43,7 @@ h5write(fpath, "/y1", y1)
% Place for post-processing of the data, or additional related code. % Place for post-processing of the data, or additional related code.
% example_fcn is a dummy function to show the functionality % example_fcn is a dummy function to show the functionality
a = 1; a = example_fcn(a); a = 1; a = example_fcn(a);
%p = betacdf(0.5,1,1); % to test toolboxes p = betacdf(0.5,1,1); % to test toolboxes
%% Plotting %% Plotting
% This is still part of a normal script to produce plots. % This is still part of a normal script to produce plots.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment