diff --git a/+PlotID/@userDLG/userDLG.m b/+PlotID/@userDLG/userDLG.m index 3e7cbf43497a53b3f94b5520c4fa450a2948fe9d..7b82f79cd84dfb8102cdd84412971710b8ad6765 100644 --- a/+PlotID/@userDLG/userDLG.m +++ b/+PlotID/@userDLG/userDLG.m @@ -55,7 +55,7 @@ classdef userDLG obj.error(errorMessage) end end - + function [] = userMSG(obj,message) %userMSG user message without priority % MSG will only be displaye if ShowMessages is true @@ -83,5 +83,21 @@ classdef userDLG end end end -end + + methods(Static) + function [status] = userQuestion(dialogMessage) + %userQuestion displays Y/N user input + m = ''; + while ~ismember(m,{'Y','y','n','N'}) + m = input([dialogMessage,', Y/N [Y]? '],'s'); + end + if ismember(m,{'Y','y'}) + status = true; + else + status = false; + end + end + end %static + +end % class diff --git a/+PlotID/Publish.m b/+PlotID/Publish.m index 3d1db2859b1e059d2ebf6d86ff6428a86df7d431..f99bcffd83eefde03c849a92057a7c174df58ffe 100644 --- a/+PlotID/Publish.m +++ b/+PlotID/Publish.m @@ -138,7 +138,12 @@ if isfolder(fullfile(storPath,folderNameV)) msg = ['Folder ',folderNameV, ' exists - Plot was already published ']; disp(msg); dialogMsg = 'Do you want to overwrite the existing files'; - overwriteDir = dlgObj.userDialog(dialogMsg, msg); + overwriteDir = dlgObj.userQuestion(dialogMsg); + if ~overwriteDir % USR does not want to overwrite + warning('PlotID has finished without an export'); + disp('rerun TagPlot if you need a new ID or consider overwriting.'); + return; %terminate + end end % create folder if ~mkdir(fullfile(storPath,folderName))