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
%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)
......
......@@ -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)
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment