diff --git a/example.m b/example.m index 45c7e397413a2fced53e8923880947073218ffd5..b160cbff3ecf7d5ee3cb5513bdd5dcbf0b6b571d 100644 --- a/example.m +++ b/example.m @@ -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 diff --git a/fcn_core/Publish.m b/fcn_core/Publish.m index cd00f6280ce5ffcc81366c018266770387c64b4a..5e941ce615cbc6ce7ae0e878d2259f0258bdb74b 100644 --- a/fcn_core/Publish.m +++ b/fcn_core/Publish.m @@ -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']); diff --git a/test_data.mat b/test_data.mat index d134e7fb0ee14a0301e5a87b08ad8b0dbe3416ed..f370a2c4bfb09d1835f12174e0af259ae2eddbd0 100644 Binary files a/test_data.mat and b/test_data.mat differ diff --git a/testdata_2.h5 b/testdata_2.h5 index d6242fea21830dddd8588742028ad681787aacb2..99ef780a89c863b96e21683ebb76e8e060a806a8 100644 Binary files a/testdata_2.h5 and b/testdata_2.h5 differ