-
Notifications
You must be signed in to change notification settings - Fork 5
/
findSerialDate.m
30 lines (23 loc) · 1.05 KB
/
findSerialDate.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
function [data, dataInfo, info] = findSerialDate(data, dataInfo, info)
fprintf('\nStoring serial date number in first column of each table and deleting columns 2 - 4\n')
for i = 1:length(data)
fprintf('Finding serial dates for table %g\n',i)
% check to make sure table loaded
if ~isempty(data{i})
% store in col 1 of table
data{i}(:,1) = campbellDate2SerialDate(data{i});
% delete columns 2-4
data{i}(:,2:4) = [];
% store begin and end date in dateInfo
row = find(cellfun(@isempty,dataInfo(:,i))==1,1,'first');
if isempty(row)
dataInfo{end+1,i} = strcat('beg date:',datestr(data{i}(1,1)));
dataInfo{end+1,i} = strcat('end date:',datestr(data{i}(end,1)));
else
dataInfo{row,i} = strcat('beg date:',datestr(data{i}(1,1)));
dataInfo{row+1,i} = strcat('end date:',datestr(data{i}(end,1)));
end
info.date = datestr(data{i}(1,1),'yyyy_mm_dd');
end
end
end