MATLAB: Creating a time input dialog and plotting in the time period.

excelinputtimetoolbox

I would like to plot specific variables with their time and values, that have been saved and imported from Excel. Which I already did.
Now I have to add a new part in the code, which is adding an input dialog where I can write a time stamp or period which the variable would only be plotted between the start time (st) and the end time (et) in the "HH:MM:SS" format that have been written in the dialog. I tried the code below and I got the following error for the two last disp lines of the inputbox.
Error using horzcat
The following error occurred converting from char to struct:
Conversion to struct from char is not possible.
Is there a way how write the two start and end times and plot the variables ( which are written in the U variable) only in the time stamp that was put in the dialog box?
answer = questdlg('is there a time stamp available? y = yes, n = no',...
'input',...
'y','n','n');
if (answer == 'y')
st.Format='hh:mm:ss';
et.Format='hh:mm:ss';
st = input( ' Please add the starttime in [HH:MM:SS] '])
et = input( ' Please add the endtime in [HH:MM:SS] '])
end
S = load('matlabtable.mat');
T = S.HV801000front10Vml2;
U = {'E1_ABD_FoamEventCnt','E1_LD_ActualStatus','H1_PRESSURE_S15hPa'};
for k = 1:numel(U)
X = T.Variable==U(k);
Wert = T.Value(X);
Uhrzeit = round(seconds(T.time(X)/1000));
Uhrzeit.Format='hh:mm:ss';
Uhrzeit = sort( Uhrzeit,'ascend');
nexttile
plot(T.time(X),T.Value(X))
xlabel('time')
title(char(U(k)),'Interpreter','none')
end

Best Answer

You have additional ] at the end of input box. Plus you have defined st and at as structure. Define them outside the if condition.
% if true
% code
%end
answer = questdlg('is there a time stamp available? y = yes, n = no',...
'input',...
'y','n','n');
if (answer == 'y')
% st.Format='hh:mm:ss'; % place this after input box
% et.Format='hh:mm:ss';
st = input( ' Please add the starttime in [HH:MM:SS] ') % here
et = input( ' Please add the endtime in [HH:MM:SS] ')% here
end