Adjust x-axis using 2 sliders in GUIDE

2 views (last 30 days)
I want to adjust the maximum and the minimum of a plot using two sliders, or any other alternative to that, the challenge is that the data that is plotted depends on x-axis values which are date and time, a piece of which is shown below. This data spans for months, so there is a lot of information.
DD.MM.YYYY hh:mm:ss;degC;degC
02.01.2018 00:00:16;29.78;30.54
02.01.2018 00:01:18;29.78;30.54
02.01.2018 00:02:19;29.78;30.54
02.01.2018 00:03:16;29.78;30.54
02.01.2018 00:04:18;29.78;30.54
02.01.2018 00:05:19;29.78;30.54
The data for the time along with the temperature readings are saved in a column using the following code format.
f = dir('*.log');
handles.alldatatable = [];
for ii = 1:numel(f)
DayFile = f(ii).name;
opts = detectImportOptions(DayFile);
opts = setvartype(opts,1,'datetime');
opts = setvaropts(opts,1,'InputFormat','dd.MM.uuuu HH:mm:ss');
table1 = readtable(DayFile,opts);
if isempty(handles.alldatatable)
handles.alldatatable = table1;
else
handles.alldatatable = [handles.alldatatable; table1];
end
end
How do I get two sliders to adjust datetime format values, one adjusting the minimum and the other adjusting the maximum points of the time in a plot?
  4 Comments
Jan
Jan on 3 Aug 2018
It is a really bad idea to use the ApplicationData of the root object to store data. This has the same disadvantages as global variables. Use guidata to store the values inside the figure of the GUI.
Chamath Vithanawasam
Chamath Vithanawasam on 3 Aug 2018
Understood, will try and make some changes.

Sign in to comment.

Answers (1)

Jan
Jan on 2 Aug 2018

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!