diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m index 85a2b3dd10af0bae2870fb9c17fca88a861cd72e..40f4fcd6ad976f730b654fb48711b1825358cad2 100644 --- a/+PlotID/Publish.m +++ b/+PlotID/Publish.m @@ -46,6 +46,11 @@ if isstring(scriptPath) scriptPath = char(scriptPath); end +% ensure ParentFolder has no trailing fileseperator +if contains(options.ParentFolder(end),filesep) + options.ParentFolder(end)=''; +end + %catch multiple figures in fig if numel(figure) > 1 figure = figure(1); diff --git a/+PlotID/createLinkedHDF5.m b/+PlotID/createLinkedHDF5.m index ffdffefae40300502eceaa03830d92e0b2d58c98..547240bf0575e72b6ad84b940bddde9eeb0832dc 100644 --- a/+PlotID/createLinkedHDF5.m +++ b/+PlotID/createLinkedHDF5.m @@ -12,11 +12,17 @@ end [~,filename,ext] = fileparts(SourceFile); +% create GroupName to avoid internal path issues on linux/unix systems +GroupName = split(SourceFile,filesep); +% Using windows fileseperator for the object name +GroupName = join(GroupName,'\'); +GroupName = GroupName{:}; + try fid = H5F.create(fullfile(TargetPath,[filename,ext])); %create External Link to Sourcefile in the Group linkToExternal - H5L.create_external(['..',filesep,SourceFile],'/',fid, SourceFile ,plist_id,plist_id); - %H5L.create_external(['..,filesep,'data',filesep,SourceFile],'/',fid, SourceFile ,plist_id,plist_id); %original + H5L.create_external(['..',SourceFile],'/',fid, GroupName ,plist_id,plist_id); + %H5L.create_external(['..,filesep,'data',SourceFile],'/',fid, GroupName ,plist_id,plist_id); %original H5F.close(fid); disp([fullfile(TargetPath,[filename,ext]),' created']); status = 1; diff --git a/CI_files/example_test.m b/CI_files/example_test.m index 1a07617c77001c99ba09d12bdd9f38d69d300f11..366bc44fe6ccf238c63e0feef591acdc6b026b88 100644 --- a/CI_files/example_test.m +++ b/CI_files/example_test.m @@ -22,7 +22,7 @@ end exampleList = {'PlotID_example','PlotID_advanced',... - 'PlotID_QRcode', 'PlotID_variables' }; + 'PlotID_QRcode', 'PlotID_centralized','PlotID_variables'}; % initialise diff --git a/Examples/PlotID_centralized.m b/Examples/PlotID_centralized.m index 025dbbfaf1fd5a7cb47df7748837dab16ecd216d..dda829aaf34196a42b394923c819c8f9ac2bcb3b 100644 --- a/Examples/PlotID_centralized.m +++ b/Examples/PlotID_centralized.m @@ -25,9 +25,9 @@ plot(x.^2,y,'-r'); PlotID.Publish(datapath,scriptPath, fig2, 'Method','centralized') %% Note: -% If you rerun this script PlotId will tell you that a identical named (but -% not binary idetical) file exists in the data folder. This is intended, -% due protect the user from overwritting non (binary) identical files. The -% reason for this is that two hdf files with the same data are not idetical +% If you rerun this script PlotId will tell you that an identically named (but +% not binary identical) file exists in the data folder. This is intended +% to protect the user from overwritting non (binary) identical files. The +% reason for this is that two hdf files with the same data are not identical % when recreated (see line 11). Usually you would use an existing file % without changing it. \ No newline at end of file diff --git a/README.md b/README.md index 1c308b22ec80caf5c791f0c28d60498047d39919..b79f1e88a26cca1f2c057f2c7b70558da03e55dc 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,20 @@ The **ProjectID** is your custom project number, it well be the prefix of the ID `PlotID.Publish(DataPaths,scriptPath, figure, options)` `scriptPath` contains either the path to the script, this can be provided with the simple call of `scriptPath = [mfilename('fullpath'),'.m']` or the script or function name that is used for creating your plot. \ -`DataPaths` contains the path(s) to the research data, for multiple files you can use a cell array (We recommend using absolute paths). It is also possible to pass an arbitrary number of variables as struct. \ +`DataPaths` contains the path(s) to the research data, for multiple files you can use a cell array (We recommend using absolute paths). It is also possible to pass an arbitrary number of variables as struct. To generate all paths for a filetype try: `f=dir(/folderpath/*.mat); rdata=fullfile({f.folder},{f.name})`. \ `figure` is the figure that should be published. +** Minimal Example:** +```matlab +fig = figure; +plot(x,y); +[fig, IDs] = PlotID.TagPlot(fig); +script = [mfilename('fullpath'),'.m']; % This creates a path to the script this line is called from +rdata = {'\\fullpath\dataset01.mat', '\\fullpath\dataset02.h5'} ; % a single path does not need a cell array +PlotID.Publish(rdata, script, fig); +``` + + **Please take also a look on the examples provided in the Example folder**. @@ -122,6 +133,9 @@ The config file is a JSON-File. The config file stores user data and options of **Note:** If you mess up your config-file simply delete it, PlotID will create a new one the next time you use it. +## Default config.json + + ## Define an export path If you define an export path in the config.json this path is used as location for the exported data.