Skip to content
Snippets Groups Projects
Commit 15a35a18 authored by Lemmer, Jan's avatar Lemmer, Jan
Browse files

Merge branch 'dev/datapath-handle-all-structs' into 'development'

Dev/datapath handle all structs

See merge request !54
parents 6cd717fd 835a70f6
No related branches found
No related tags found
2 merge requests!62Introduce changes for V1.0 RC 1,!54Dev/datapath handle all structs
Pipeline #652637 passed
...@@ -66,7 +66,7 @@ classdef dataPath < handle ...@@ -66,7 +66,7 @@ classdef dataPath < handle
function cleanTmpFile(obj) function cleanTmpFile(obj)
if ~isempty(obj.tmpPath) if ~isempty(obj.tmpPath)
delete(obj.tmpPath); delete(obj.tmpPath{:});
end end
end end
......
...@@ -9,15 +9,24 @@ if ~isfolder(tmpDir) ...@@ -9,15 +9,24 @@ if ~isfolder(tmpDir)
end end
obj.tmpPath = fullfile(tmpDir,[obj.ID,'_vars.mat']); obj.tmpPath = fullfile(tmpDir,[obj.ID,'_vars.mat']);
% save only the first struct (intended) % save each of the structs
for i=1:numel({obj.DataPaths{isStruct}})
struct = obj.DataPaths{isStruct}; struct = obj.DataPaths{isStruct};
if i==1
save(obj.tmpPath,'-struct','struct'); save(obj.tmpPath,'-struct','struct');
obj.tmpPath = {obj.tmpPath};
else
tmpPath = fullfile(tmpDir,[obj.ID,'_vars',num2str(i),'.mat']);
save(tmpPath,'-struct','struct');
obj.tmpPath{end+1}=tmpPath;
end
end
% remove variable from Datapath % remove variable from Datapath
obj.DataPaths(isStruct) = []; obj.DataPaths(isStruct) = [];
% add tmppath as Datapath % add tmppath as Datapath
obj.DataPaths{end+1} = obj.tmpPath; obj.DataPaths = horzcat(obj.DataPaths, obj.tmpPath);
end end
...@@ -15,10 +15,9 @@ plot(x,y,'-k'); box off; set(gca, 'TickDir', 'out', 'YLim', [0,4]); ...@@ -15,10 +15,9 @@ plot(x,y,'-k'); box off; set(gca, 'TickDir', 'out', 'YLim', [0,4]);
%% ---- 2. Publishing ----- %% ---- 2. Publishing -----
% You can pass an abitrary number of variables to Publish. % You can pass an abitrary number of variables to Publish.
% IMPORTANT: they must be collected and passed in ONE struct % Passing multiple structs will create multiple data files.
% if multiple structs are passed, only the first one will be stored!
% You can additionally add datapaths and combine the methods. % You can additionally add datapaths and combine the methods.
% Passing multiple structs
%Example: Passing the variables x,y to publish %Example: Passing the variables x,y to publish
......
...@@ -29,7 +29,7 @@ The **ProjectID** is your custom project number, it well be the prefix of the ID ...@@ -29,7 +29,7 @@ The **ProjectID** is your custom project number, it well be the prefix of the ID
`PlotID.Publish(DataPaths,scriptPath, figure, options)` `PlotID.Publish(DataPaths,scriptPath, figure, options)`
`scriptPath` contains either the path to the script, this can be provided with the simple call of `scriptPath = [mfilename('fullpath'),'.m']` or the script or function name that is used for creating your plot. \ `scriptPath` contains either the path to the script, this can be provided with the simple call of `scriptPath = [mfilename('fullpath'),'.m']` or the script or function name that is used for creating your plot. \
`DataPaths` contains the path(s) to the research data, for multiple files you can use a cell array (they must be at the path). It is also possible to pass an arbitrary number of variables. All variables **must be** passed in **one** struct. \ `DataPaths` contains the path(s) to the research data, for multiple files you can use a cell array (they must be at the path). It is also possible to pass an arbitrary number of variables as struct. \
`figure` is the figure that should be published. `figure` is the figure that should be published.
**Please take also a look on the examples provided in the Example folder**. **Please take also a look on the examples provided in the Example folder**.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment