diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m index 34917d3fa655c260fd48827af524c4c0805538e1..6cf46238f927923222082a086d4c50fdcf3df9b5 100644 --- a/+PlotID/Publish.m +++ b/+PlotID/Publish.m @@ -33,6 +33,18 @@ arguments end %% argument validation +%catch string and non cell inputs in DataPaths +if ~iscell(DataPaths) + DataPaths = {DataPaths}; %Cell array +end + +for i=1:numel(DataPaths) + if isstring(DataPaths{i}); + % strings will cause problems + DataPaths{i} = char(DataPaths{i}); + end +end + %catch multiple figures in fig if numel(figure) > 1 figure = figure(1); @@ -248,14 +260,13 @@ end function mustBeDataPath(DataPaths) %checks if input is a valid DataPath object - - if isstring(DataPaths) - tf = zeros(1,numel(DataPaths)); - for i=1:numel(DataPaths) - tf(i) = ~isfile(DataPaths{i}); - end - else - tf = ~isfile(DataPaths); + if ~iscell(DataPaths) + DataPaths = {DataPaths}; + end + tf = zeros(1,numel(DataPaths)); + + for i=1:numel(DataPaths) + tf(i) = ~isfile(DataPaths{i}); end if any(tf) diff --git a/example.m b/example.m index 6ef682af0953da218e07ae365e3618906d8bcdd9..3f86ce5b8528dd67ac5fd78664ccd2a6265391e7 100644 --- a/example.m +++ b/example.m @@ -76,8 +76,8 @@ scriptPath = [mfilename('fullpath'),'.m']; %(defined above:) dataset1 = 'test_data.mat'; dataset2 = 'testdata2.h5' locations = {dataset1,dataset2} ; % don't forget the extension +locations = {string(dataset1),dataset2} -%locations = {'test_data.mat', 'falsch'}; %call publishing PlotID.Publish(locations,scriptPath, fig(1), 'Location', 'local' ,'Method','individual')