diff --git a/+PlotID/@dataPath/dataPath.m b/+PlotID/@dataPath/dataPath.m index 922e3a9d6a216b3ce8572f5e576f116a94565944..e16488ac94fdca89fef749c3aa3b88a770acf8f7 100644 --- a/+PlotID/@dataPath/dataPath.m +++ b/+PlotID/@dataPath/dataPath.m @@ -14,11 +14,19 @@ classdef dataPath < handle %DATAPATH Construct an instance of this class % start with argument validation obj.ID = ID; + %catch non cell inputs in inputPaths if ~iscell(inputPaths) inputPaths = {inputPaths}; %Cell array end + + + % handle nested cell arrays + while any(cellfun(@iscell,inputPaths)) + inputPaths = [inputPaths{cellfun(@iscell,inputPaths)} inputPaths(~cellfun(@iscell,inputPaths))] + end + isStruct = false([1,numel(inputPaths)]); % strings will cause problems, therefore chars are used for i=1:numel(inputPaths) diff --git a/Examples/PlotID_variables.m b/Examples/PlotID_variables.m index 9ebc1aac9d9132418fd1f2e9f1714ef15d809372..e24704d17561d7ce5bd8624bbf8c5e2dbd0168f7 100644 --- a/Examples/PlotID_variables.m +++ b/Examples/PlotID_variables.m @@ -24,8 +24,8 @@ plot(x,y,'-k'); box off; set(gca, 'TickDir', 'out', 'YLim', [0,4]); s.x =x; s.y=y; % Save both variables in struct s -% Build the locations cell with the struct and one path -locations = {s,'test_data.mat'}; +% Build the locations cell with the struct and one path or an array of paths +locations = {s,datapath}; %call publish PlotID.Publish(locations,scriptPath, fig1) diff --git a/PlotID_example.m b/PlotID_example.m index c944839efba357799a416e74a595ae813c6c3849..33deaf19ac8f385537f2d543099f6906d777eca4 100644 --- a/PlotID_example.m +++ b/PlotID_example.m @@ -53,6 +53,7 @@ fig2 = figure; plot(x,y,'-k'); box off; set(gca, 'TickDir', 'out', 'YLim', [0,4] % Publish(DataPaths,scriptPath, figure, options) % Path of the m.script that you use for creating your plot. +% note: mfilename only works if called from within a script or function scriptPath = [mfilename('fullpath'),'.m']; % file paths of the datasets used for the plot (don't forget the extension) @@ -63,12 +64,12 @@ locations = datapath; %call publish PlotID.Publish(locations,scriptPath, fig2) -% Your plot, script and all the data that your provide are now published. +% Your plot, script and all the data that you provided are now published. % --------------------------------- %% Further examples and help % You find more examples in the Examples folder: -% - Passing Variables +% - Passing Variables % - Advanced usage % - Working with HDF5-files % - Using a central data folder