-
Notifications
You must be signed in to change notification settings - Fork 0
/
AR_Plot_THL.m
68 lines (50 loc) · 1.6 KB
/
AR_Plot_THL.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function AR_Plot_THL(days)
% plot temperature and Humidity logs for the last week
% WALIII
% 08/14/16
% Run in the directory with the .csv logs:
DIR = pwd;
mov_listing=dir(fullfile(DIR,'*.csv'));
% Sort data by most recent:
S = [mov_listing(:).datenum].';
[S,S] = sort(S);
mov_listing={mov_listing(S).name};
filenames=mov_listing;
counter = 1; %set startup counter
% itterate through logs
for i=length(filenames)-days:length(filenames);
M = csvread(filenames{i},1,1);
if counter>1;
M1 = vertcat(M1,M);
else
M1 = M;
end
counter = 2;
end
% Convert to datetime vector:
t = datetime(M1(:,1),M1(:,2),M1(:,3),M1(:,4),M1(:,5),M1(:,6));
% general graphics, this will apply to any figure you open
% (groot is the default figure object).
set(groot, ...
'DefaultFigureColor', 'w', ...
'DefaultAxesLineWidth', 0.5, ...
'DefaultAxesXColor', 'k', ...
'DefaultAxesYColor', 'k', ...
'DefaultAxesFontUnits', 'points', ...
'DefaultAxesFontSize', 20, ...
'DefaultAxesFontName', 'Helvetica', ...
'DefaultLineLineWidth', 1, ...
'DefaultTextFontUnits', 'Points', ...
'DefaultTextFontSize', 20, ...
'DefaultTextFontName', 'Helvetica', ...
'DefaultAxesBox', 'off', ...
'DefaultAxesTickLength', [0.02 0.025]);
% set the tickdirs to go out - need this specific order
set(groot, 'DefaultAxesTickDir', 'out');
set(groot, 'DefaultAxesTickDirMode', 'manual');
% plot the data:
figure(); plot(t, tsmovavg(M1(:,8),'s',1000,1),'LineWidth',4); hold on; plot(t,tsmovavg(M1(:,7),'s',1000,1),'LineWidth',4);
legend('Temp (C)','Humidity');
title(strcat('T/H logs for the last ',' ~',num2str(days),' days'));
xlabel('Date');
ylabel('Temperature / Humidity');