diff --git a/+PlotID/@userDLG/userDLG.m b/+PlotID/@userDLG/userDLG.m index d053ced79fd2a7a1855c930daaac33e1da28f08b..3ec2b4b9f2af8d2833631b67a52cf9d0f1c1a8a0 100644 --- a/+PlotID/@userDLG/userDLG.m +++ b/+PlotID/@userDLG/userDLG.m @@ -51,7 +51,7 @@ classdef userDLG end end - function [] = error(message) + function [] = error(obj,message) %error handles critical errors % critical errors will always result in a matlab error diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m index 1dddfef852921c901f6512232741041e80869ccc..34917d3fa655c260fd48827af524c4c0805538e1 100644 --- a/+PlotID/Publish.m +++ b/+PlotID/Publish.m @@ -24,6 +24,7 @@ arguments options.Location {mustBeMember(options.Location ,{'local','server','manual','CI-Test'})} = 'local' % storage path options.Method {mustBeMember(options.Method ,{'individual','centralized'})} = 'individual' options.ParentFolder (1,:) {mustBeText} = 'export' + options.ConfigFileName (1,:) {mustBeText} = 'config.json' %individual config names possible options.CopyUserFCN (1,1) {mustBeNumericOrLogical} = true options.CSV (1,1) {mustBeNumericOrLogical} = false options.ShowMessages(1,1) {mustBeNumericOrLogical} = true @@ -42,8 +43,8 @@ if numel(figure) > 1 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,... @@ -54,8 +55,8 @@ if isempty(ID) warning(msg); end -dlgObj = PlotID.userDLG(ID,options); % Error and MSG handeling - +% Error and MSG handeling +dlgObj = PlotID.userDLG(ID,options); %% read config file try @@ -63,9 +64,6 @@ try config = jsondecode(txt); catch dlgObj.configError = true; - msg = ['Error while reading the config file' newline,... - ' publishing on server not possible']; - dlgObj.softError(msg); end %% storage location @@ -79,7 +77,12 @@ switch options.Location storPath = fullfile(scriptLocation,options.ParentFolder); end case 'server' %from config File - storPath = config.ServerPath; + if dlgObj.configError + msg = ['Error while reading the config file' newline,... + ' publishing on server not possible']; + dlgObj.error(msg); + end + storPath = config.ServerPath; case 'manual' %UI storPath = uigetdir(); case 'CI-Test' @@ -88,7 +91,7 @@ end folderName = ['.',char(ID)]; %hidden folder -%% Create Data-Directory +%% Create data directory if isfolder(fullfile(storPath,folderName)) dlgObj.error(['Folder ',folderName, ' exists - Plot was already published ']); elseif mkdir(fullfile(storPath,folderName)) @@ -97,7 +100,7 @@ else end disp(['publishing of ', ID, ' started']); -%% Create a Copy of the script and user functions(optional) +%% Create a copy of the script and user functions(optional) % script [~, status, msg] = PlotID.createFileCopy({scriptPath},folderName,storPath,ID, 'script'); dlgObj.scriptPublished =status; diff --git a/.gitignore b/.gitignore index 708bea6b2032d70640c74a197d183a115ff0bdda..32ea2493881e83b59a61c69dbd6ba01281a72d3b 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ testdata_2.h5 testdata2.h5 test_data.mat export/* +unused*/* # Octave session info octave-workspace