diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m index 01eb66bea5f7b6cc0ce39b5416f0389996f5f6fe..414da6593e2b906c9c04df78fdf1a33608e4ab57 100644 --- a/+PlotID/Publish.m +++ b/+PlotID/Publish.m @@ -14,6 +14,7 @@ arguments options.Location {mustBeMember(options.Location ,['local','server','CI-Test'])} = 'local' % storage path options.Method {mustBeMember(options.Method ,['individual','centraliced'])} = 'individual' options.CopyUserFCN (1,1) {mustBeNumericOrLogical} = true + options.CSV (1,1) {mustBeNumericOrLogical} = false end %catch multiple figures in fig @@ -27,7 +28,9 @@ end switch options.Location case 'local' - storPath = fullfile(pwd,'export'); + % use the script path as export path + scriptPath = fileparts(DataPaths.script); + storPath = fullfile(scriptPath,'export'); case 'server' %from config File txt = fileread('config.json'); config = jsondecode(txt); @@ -63,7 +66,7 @@ end %% Research data handeling switch options.Method - case 'centraliced' % Work in progresss!!! + case 'centraliced' % check if data folder exists if ~isfolder(fullfile(storPath,'data')) mkdir(fullfile(storPath,'data')); @@ -93,20 +96,30 @@ switch options.Method PlotID.createFileCopy(DataPaths.rdata,folderName,storPath,ID, 'data'); end %% Export the Plot -%try +try PlotName = [ID,'_plot']; % plotname RemotePath = fullfile(storPath ,folderName, PlotName); % Matlab figure savefig(figure,RemotePath); % the png should only be a preview exportgraphics(figure,[RemotePath,'.png'],'Resolution',300); -% end -% catch -% warning('Plot export was not successful') -% end +catch + warning('Plot export was not successful') +end disp(['publishing of ', ID , ' done']); +% CSV EXport +if options.CSV + T = table(); + T.research_Data = DataPaths.rdata'; T.PlotID(:) = {ID}; + T.Script_Name(:) = {[DataPaths.script,'.m']}; + T.Storage_Location(:) = {storPath}; + T.Date(:) = {datestr(now)}; + T = movevars(T,'PlotID','before',1); + writetable(T, fullfile(storPath, 'overview_table.csv'),'WriteMode','append'); +end + end %function function tf = mustBeFigure(h) diff --git a/example.m b/example.m index 8587451f65744158b09a3707553b30e1bc19fc0b..a757121d36199ecbd0c50363e4492efb9eaaa9fe 100644 --- a/example.m +++ b/example.m @@ -77,7 +77,7 @@ path.script = mfilename('fullpath'); % filename of the m.script % file names of the datasets path.rdata = {dataset1,dataset2} ; % don't forget the extension -PlotID.Publish(path, ID, fig(1), 'Location', 'local','Method','centraliced') +PlotID.Publish(path, ID, fig(1), 'Location', 'server' ,'Method','centraliced') %% Example 2: multiple plots plot, all based on data-set2 (hdf5) % for individual data-sets, use an appropriate array