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

Add documentation for varibale export

parent 0de564f1
Branches
Tags
2 merge requests!62Introduce changes for V1.0 RC 1,!51Resolve "Möglichkeit Datenvariablen zu übergeben anstelle von Dateipfaden"
Pipeline #650047 passed
......@@ -9,6 +9,7 @@ if ~isfolder(tmpDir)
end
obj.tmpPath = fullfile(tmpDir,[obj.ID,'_vars.mat']);
% save only the first struct (intended)
struct = obj.DataPaths{isStruct};
save(obj.tmpPath,'-struct','struct');
......
......@@ -2,20 +2,21 @@ function Publish(DataPaths,scriptPath, figure, options)
%%Publish(DataPaths,scriptPath, ID, figure, options) saves plot, data and measuring script
%
% DataPaths contains the path(s) to the research data, for multiple files
% use a cell array
% use a cell array or ONE struct of variables (only the first struct will
% be exported)
% scriptPath contains the path to the script, this can be provided with
% the simple call of scriptPath = [mfilename('fullpath'),'.m']
%
% Options:
% Location sets the storage location. 'local' sets the storage location
% to the current folder (an export folder will be created), 'manual' opens
% a explorer window, where you can choose the folder. If you define a export
% path in the config file, this will used per defaul (exportPath).
% an explorer window, where you can choose the folder. If you define a export
% path in the config file, this will used per default (exportPath).
% remote path, that is defined in the config file.
% Two Methods are implemented 'individual' stores the data for
% each plot while 'centralized' uses a data folder and uses reference links
% to the original data (hdf5 only).
% 'ParentFolder' is the folder Name where the exported data is stored if an
% 'ParentFolder' is the folder name where the exported data is stored if an
% path is used, PlotId will use this path as storagePath
% 'ConfigFileName' is needed for handling multiple config files (see example)
% 'CSV' turns a summary table of all exports on or off
......@@ -26,7 +27,7 @@ function Publish(DataPaths,scriptPath, figure, options)
% 'ForcePublish' will publish even if one step was not successful (not recommended)
arguments
DataPaths % location of the data-file(s)
DataPaths % location of the data-file(s) and/or ONE struct of variables
scriptPath (1,:) {mustBeText} % location of the matlab script
figure (1,:) {mustBeFigure} % Checks if figure is a figure object
options.Location {mustBeMember(options.Location ,{'local','exportPath','manual','CI-Test'})} = 'local' % storage path
......
# V0.3
- Add changelog
- Add support for file or function name as scriptPath
- Add support for passing Variables in publish
clear; clc; close all;
%% Example Script - How to pass Variables
% This script how to pass variables instead or additional to the DataPaths
%% Data (only necessary for this example)
[x, y, datapath] = createExampleData('matlab');
scriptPath = mfilename('fullpath');
%% Plotting
% This is still part of a normal script to produce plots.
% Make sure to save each figure in a variable to pass it to PlotID-functions.
fig1 = figure;
plot(x,y,'-k'); box off; set(gca, 'TickDir', 'out', 'YLim', [0,4]);
[fig1, ID] = PlotID.TagPlot(fig1);
%% ---- 2. Publishing -----
% You can pass an abitrary number of variables to Publish.
% IMPORTANT: they must be collected and passed in ONE struct
% if multiple structs are passed, only the first one will be stored!
% You can additionally add datapaths and combine the methods.
% Passing multiple structs
%Example: Passing the variables x,y to publish
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'};
%call publish
PlotID.Publish(locations,scriptPath, fig1)
% Your plot, script, the variables x,y and the path that your provided
% are now published.
......@@ -29,8 +29,10 @@ The **ProjectID** is your custom project number, it well be the prefix of the ID
`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. \
`DataPaths` contains the path(s) to the research data, for multiple files you can use a cell array (they must be at the path). \
`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. \
`figure` is the figure that should be published.
**Please take also a look on the examples provided in the Example folder**.
# PlotID.TagPlot()
......@@ -72,7 +74,9 @@ FriendlyID Changes the Hex Number to a human friendly *datetime* and *dateStr*.
# PlotID.Publish()
`Publish(DataPaths,scriptPath, figure, options)` \
Publishes saves plot, data and measuring script
Location sets the storage location. 'local' sets the storage location to the current folder (an export folder will be created), 'server' is a remote path, that is defined in the config file. Two Methods are implemented 'individual' stores the data for each plot while 'centralized' uses a data folder and uses reference links to the original data (hdf5 only). ParentFolder is the folder Name where the exported data is stored if a path is used, PlotId will use this path a storagePath
Location sets the storage location. 'local' sets the storage location to the current folder (an export folder will be created), 'manual' opens an explorer window, where you can choose the desired folder. If you define a export path in the config file, this will used per default (exportPath).
Two Methods are implemented 'individual' stores the data for each plot while 'centralized' uses a data folder and uses reference links to the original data (hdf5 only). ParentFolder is the folder name where the exported data is stored if a path is used, PlotId will use this path a storagePath.
<details><summary>detailed description</summary>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment