I have a collection of data that is taken at specific times. I plot this data in the usual method by using plot(). I need to make changes to the x-axis limits so I use xlim() and get the two limits as datetime()
tstart = datetime(2018,02,01,15,30,00);
tend = datetime(2018,02,06,15,30,00);
xlim([tstart tend]);
Suppose I want to get this dates and times from a text entry in a GUI. Namely, the 'edit text' feature. How do I type the start time and end time to two different 'edit text's and use it in the variables 'tstart' and 'tend'? I used the following technique axes(handles.axes1); plot((a{:,1}),(a{:,listValueAA+1}));
startD = get(handles.edit2,'String');
finishD = get(handles.edit3,'String');
disp(startD);
disp(finishD);
tstart = datetime(startD);
tend = datetime(finishD);
xlim([tstart tend]);
But I get the following error.
Error using datetime (line 614)
Could not recognize the date/time format of
'2018,02,03,15,00,00'. You can specify a format
character vector using the 'InputFormat'
parameter. If the date/time text contains day,
month, or time zone names in a language foreign
to the 'en_US' locale, those might not be
recognized. You can specify a different locale
using the 'Locale' parameter.
Error in GUI_for_log>pushbutton1_Callback (line
156)
tstart = datetime(startD);
What exactly should I change to get the data plotted according to the input datetime?
0 Comments
Sign in to comment.