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

Fixes #48

remove ID as input from publsish
add UserInput in case of missing ID
parent 0bea01b9
No related branches found
No related tags found
1 merge request!21Fixes #48
Pipeline #573255 passed
function Publish(DataPaths,scriptPath, ID, figure, options)
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
......@@ -20,7 +20,6 @@ function Publish(DataPaths,scriptPath, ID, figure, options)
arguments
DataPaths {mustBeDataPath} % location of the data-file(s)
scriptPath (1,:) {mustBeFile} % location of the matlab script
ID (1,:) {mustBeNonzeroLengthText} % ID must be provided
figure (1,:) {mustBeFigure} % Checks if figure is a figure object
options.Location {mustBeMember(options.Location ,{'local','server','manual','CI-Test'})} = 'local' % storage path
options.Method {mustBeMember(options.Method ,{'individual','centralized'})} = 'individual'
......@@ -29,6 +28,7 @@ arguments
options.CSV (1,1) {mustBeNumericOrLogical} = false
end
%% argument validation
%catch multiple figures in fig
if numel(figure) > 1
figure = figure(1);
......@@ -38,6 +38,20 @@ if numel(figure) > 1
warning(msg);
end
%get ID from Figure
ID = figure.Tag;
if isempty(ID)
% no ID found, User dialog for Folder name
ID = inputdlg(['No ID defined- ' newline,...
'Please enter a folder name to continue:'],'Please enter a folder name');
ID = ID{1};
msg = ['No ID found - consider to use the TagPlot function before ',...
'you publish ', newline, 'your files will be stored in ' , ID];
warning(msg);
end
%% read config file
try
txt = fileread('config.json');
......
......@@ -56,7 +56,7 @@ try
% file name of the data
rdata = {dataset1,dataset2} ; % don't forget the extension
PlotID.Publish(rdata,script, ID, figs, 'Location', 'CI-Test')
PlotID.Publish(rdata,script, figs, 'Location', 'CI-Test')
result = true;
% clean up
......
......@@ -78,7 +78,7 @@ locations = {dataset1,dataset2} ; % don't forget the extension
%locations = {'test_data.mat', 'falsch'};
%call publishing
PlotID.Publish(locations,scriptPath, ID, fig(1), 'Location', 'local' ,'Method','individual')
PlotID.Publish(locations,scriptPath, fig(1), 'Location', 'local' ,'Method','individual')
%% Example 2: multiple plots plot, all based on dataset2 (hdf5)
% for individual data-sets, use an appropriate array
......@@ -99,7 +99,7 @@ rdata = dataset2 ; % don't forget the extension
% publsihing via a for-loop
for i=1: numel(fig)
PlotID.Publish(rdata, script, IDs{i}, fig(i), 'Location', 'local',...
PlotID.Publish(rdata, script, fig(i), 'Location', 'local',...
'Method','individual');
end
......@@ -117,4 +117,4 @@ plot(x1,y1,'-r');
[fig2, ID] = PlotID.TagPlot(fig2,'ProjectID', ProjectID);
PlotID.Publish(locations,scriptPath, ID, fig2, 'Location', 'local','Method','centralized')
PlotID.Publish(locations,scriptPath, fig2, 'Location', 'local','Method','centralized')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment