diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m index 1843f8d2b4915fdcedf7daa59ad4cb60d1ac76d7..91e8caed6985d9fd1cf6752d7cb25263b71a45ac 100644 --- a/+PlotID/Publish.m +++ b/+PlotID/Publish.m @@ -94,7 +94,7 @@ switch options.Method if any(idx) sourcePath = fList{idx,'name'}; % If there are multiple copies already, this only picks the last entry if contains(sourcePath,{'.h5','.hdf5'}) % Linking only for HDF5 - PlotID.createLinkedHDF5(sourcePath,storPath,ID); + PlotID.createLinkedHDF5(sourcePath{1,1},storPath,ID); end else % no identical file exists %Copy the file in data diff --git a/+PlotID/TagPlot.m b/+PlotID/TagPlot.m index 26aee3e987daed7c39f29283c410e9a81cf056fe..bcf84b912018f4da1a084a530a7e19bc87d31819 100644 --- a/+PlotID/TagPlot.m +++ b/+PlotID/TagPlot.m @@ -21,8 +21,16 @@ arguments end if isempty(options.ProjectID) - txt = fileread('config.json'); - config = jsondecode(txt); + try + txt = fileread('config.json'); + config = jsondecode(txt); + catch + config =struct; + config.ProjectID = ''; + warning("No ProjectID was definded and no config.json could be found"); + + end + if ~isempty(config.ProjectID) options.ProjectID = config.ProjectID; else @@ -47,7 +55,7 @@ switch options.Location % Check if Position is valid if ~all(0 <= options.Position & options.Position <= 1) options.Position = [1,0.4]; - warning('options.Position is not valid, TagPlot default values instead'); + warning('options.Position is not valid, TagPlot uses default values instead'); end otherwise % set default position warning([options.Location, ' is not a defined location, TagPlot uses location east instead']); diff --git a/PlotID_Demo.m b/PlotID_Demo.m index 961afc7782d09a4a25906ed7452b2a63fd40848e..ac720c08582050a3f2f4fbd8f11a9d4262103902 100644 --- a/PlotID_Demo.m +++ b/PlotID_Demo.m @@ -18,15 +18,18 @@ ProjectID = 'FST01'; x = linspace(0,7); y = rand(1,100)+2; dataset1 = 'test_data.mat'; -save('test_data.mat','x','y'); +% use absolute paths for good practise +dataset1 = fullfile(pwd, dataset1); +save(dataset1,'x','y'); % some data as .h5 x1 = linspace(0,2*pi); y1 = sin(x1)+.5*sin(2*x1)+2; % define file path & name -fpath = "./testdata_2.h5"; -dataset2 = 'testdata_2.h5'; + +fpath = fullefile(pwd,"./testdata_2.h5"); +dataset2 = fullfile(pwd,'testdata_2.h5'); % create hdf5 file and dataset > write data to hdf5 file / dataset h5create(fpath, "/x1", size(x1), "Datatype", class(x1)) diff --git a/config.json b/config.json deleted file mode 100644 index 23a100c868e7c78b81aab755d9b436c97c939ef5..0000000000000000000000000000000000000000 --- a/config.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "ProjectID": "JL01", - "ServerPath": "\\\\FST-220\\Jans-50GB-SMB\\Lemmer" -} \ No newline at end of file diff --git a/example.m b/example.m index dfc42f28e2dad9c4a52d0363d2c2bcb924e73820..c73c83a0963179e3b77843ae6ff70dde8f293dd1 100644 --- a/example.m +++ b/example.m @@ -27,7 +27,9 @@ ProjectID = ''; x = linspace(0,7); y = rand(1,100)+2; dataset1 = 'test_data.mat'; -save('test_data.mat','x','y'); +% Use absolute paths for good practise +dataset1 = fullfile(pwd,dataset1); +save(dataset1,'x','y'); % some data as .h5 @@ -35,8 +37,9 @@ x1 = linspace(0,2*pi); y1 = sin(x1)+2; % define file path & name -fpath = "./testdata_2.h5"; dataset2 = 'testdata_2.h5'; +dataset2 = fullfile(pwd,dataset2); +fpath = dataset2; % create hdf5 file and dataset > write data to hdf5 file / dataset h5create(fpath, "/x1", size(x1), "Datatype", class(x1)) @@ -77,7 +80,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', 'server' ,'Method','centralized') +PlotID.Publish(path, ID, fig(1), 'Location', 'local' ,'Method','centralized') %% Example 2: multiple plots plot, all based on data-set2 (hdf5) % for individual data-sets, use an appropriate array