Skip to content
Snippets Groups Projects
Commit 72f78c3e authored by Hock, Martin's avatar Hock, Martin
Browse files

Merge branch 'dev/datapath-handle-nestedcellarrays' into 'development'

implemented cell flattening and fixxed some type

See merge request !52
parents b9c1388d 82e765c1
No related branches found
No related tags found
2 merge requests!62Introduce changes for V1.0 RC 1,!52implemented cell flattening and fixxed some type
Pipeline #650385 passed
...@@ -14,11 +14,19 @@ classdef dataPath < handle ...@@ -14,11 +14,19 @@ classdef dataPath < handle
%DATAPATH Construct an instance of this class %DATAPATH Construct an instance of this class
% start with argument validation % start with argument validation
obj.ID = ID; obj.ID = ID;
%catch non cell inputs in inputPaths %catch non cell inputs in inputPaths
if ~iscell(inputPaths) if ~iscell(inputPaths)
inputPaths = {inputPaths}; %Cell array inputPaths = {inputPaths}; %Cell array
end 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)]); isStruct = false([1,numel(inputPaths)]);
% strings will cause problems, therefore chars are used % strings will cause problems, therefore chars are used
for i=1:numel(inputPaths) for i=1:numel(inputPaths)
......
...@@ -24,8 +24,8 @@ plot(x,y,'-k'); box off; set(gca, 'TickDir', 'out', 'YLim', [0,4]); ...@@ -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 s.x =x; s.y=y; % Save both variables in struct s
% Build the locations cell with the struct and one path % Build the locations cell with the struct and one path or an array of paths
locations = {s,'test_data.mat'}; locations = {s,datapath};
%call publish %call publish
PlotID.Publish(locations,scriptPath, fig1) PlotID.Publish(locations,scriptPath, fig1)
......
...@@ -53,6 +53,7 @@ fig2 = figure; plot(x,y,'-k'); box off; set(gca, 'TickDir', 'out', 'YLim', [0,4] ...@@ -53,6 +53,7 @@ fig2 = figure; plot(x,y,'-k'); box off; set(gca, 'TickDir', 'out', 'YLim', [0,4]
% Publish(DataPaths,scriptPath, figure, options) % Publish(DataPaths,scriptPath, figure, options)
% Path of the m.script that you use for creating your plot. % 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']; scriptPath = [mfilename('fullpath'),'.m'];
% file paths of the datasets used for the plot (don't forget the extension) % file paths of the datasets used for the plot (don't forget the extension)
...@@ -63,7 +64,7 @@ locations = datapath; ...@@ -63,7 +64,7 @@ locations = datapath;
%call publish %call publish
PlotID.Publish(locations,scriptPath, fig2) 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 %% Further examples and help
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment