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

Close Bug that multiple files were overwritten,

Add the export of User FCNs (Relates #11)
parent 9b65a89e
No related tags found
3 merge requests!13PreRelease_V0.1,!12PreRelease_V0.1,!1Add Link-replacement feature
......@@ -45,8 +45,8 @@ set(gca, 'TickDir', 'out', 'YLim', [0,4]);
[figs, ID] = TagPlot(fig, ProjectID);
%% call dummy function
% a=1;
% a = test_2(a);
a=1;
a = test_2(a);
%% publishing
......
......@@ -38,8 +38,12 @@ createFileCopy({[DataPaths.script,'.m']},folderName,storPath,ID, 'script');
if options.CopyUserFCN
[fList,pList] = matlab.codetools.requiredFilesAndProducts(DataPaths.script);
% plist contains the required MATLAB Toolboxes, maybe usefull in future
fList = fList(~ismember(fList,[DataPaths.script,'.m'])); % rmv script from list
fList = removePltIdFiles(fList); % Do not copy files that are part of plot ID
if ~isempty(fList)
createFileCopy(fList,folderName,storPath,ID,'userFcn');
end
end
%% Research data handeling
......@@ -85,26 +89,28 @@ function [] = createFileCopy(filePaths,folderName,storPath,ID,type)
% Creates a copy of the files (can used for multiple paths in a cell array)
% folderName is the name of the exporting folder
disp(['Start to copy ', type]);
switch type
case 'data'
sufix = '_data';
case 'script'
sufix = '_script';
case 'userFcn'
sufix = '';
otherwise
error([type,' is not a valid type for createFileCopy'])
end %switch
try
for i = 1:numel(filePaths)
FileNameAndLocation = filePaths{i};
[~,~,ext] = fileparts(filePaths{i}); % get the extension
newbackup = sprintf([ID, sufix ,ext]);
% Write the copied file
RemotePath = fullfile(storPath,folderName, newbackup);
[~,name,ext] = fileparts(filePaths{i}); % get the extension
switch type
case 'data'
sufix = '_data';
newfile = sprintf([ID, sufix, '_' , num2str(i) ,ext]);
case 'script'
sufix = '_script';
newfile = sprintf([ID, sufix ,ext]);
case 'userFcn'
%keep original name
newfile = sprintf([name,ext]);
otherwise
error([type,' is not a valid type for createFileCopy'])
end %switch
% Write the file
RemotePath = fullfile(storPath,folderName, newfile);
copyfile(FileNameAndLocation,RemotePath);
end
disp([type, ' sucessfully published']);
......
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment