The following code might serve your requirements. Again, since you are interested in daily averages, the output would be much be smaller, as it's over a 24 hour period and I am assuming you need that. Also, it takes care of your missing data condition.
Code -
%% Setup params and data
start_hour = 17;
[num,txt,raw] = xlsread('summary_file.xls');
datenums = NaN(size(num,1),1);
for count = 1:size(num,1)
year1 = cell2mat(raw(count,1));
date1 = cell2mat(raw(count,2));
time1 = cell2mat(raw(count,3));
date_str = strcat( num2str(year1) , '-', date1 );
datenums(count) = datenum( date_str, 'yyyy-dd-mmm') + time1(:);
end
%% Take care of conditions
firstdata_start_hour = round(24*cell2mat(raw(1,3)));
if firstdata_start_hour > 17
start1 = floor(datenums(1)) + (start_hour/24);
elseif firstdata_start_hour < 17
start1 = floor(datenums(1))-1 + (start_hour/24);
else
start1 = datenums(1);
end
ind1 = floor(datenums-start1) + 1;
%% Start Processing
num_items = size(num,2)-3;
num_days = max(ind1);
bins = NaN(num_days,num_items);
for count1 = 1:size(bins,2)
for count2 = 1:size(bins,1)
bins(count2,count1) = mean(num(find(ind1==count2),count1+3));
end
end
bins(isnan(bins))=0;
average_nums = bins
Output of the averages for some data, compiled by OP on my request -
+-----------+---------------+------+-------------+------------+-----------+--------------+
| Date | Pressure(kPa) | Temp | Humidity(%) | W-spd(m/s) | Radiation | Rainfall(mm) |
+-----------+---------------+------+-------------+------------+-----------+--------------+
| 8/10/2009 | 100.1 | 25.8 | 79.1 | 1.4 | 82.6 | 1.7 |
| 8/11/2009 | 100.2 | 27.5 | 75.7 | 1.9 | 173.8 | 0.0 |
| 8/12/2009 | 100.1 | 28.4 | 73.5 | 2.1 | 177.1 | 0.0 |
| 8/13/2009 | 100.0 | 28.4 | 73.2 | 2.5 | 197.4 | 0.0 |
| 8/14/2009 | 100.0 | 28.5 | 73.5 | 2.2 | 151.2 | 0.0 |
| 8/15/2009 | 100.2 | 27.3 | 75.4 | 1.2 | 96.2 | 0.4 |
| 8/16/2009 | 100.2 | 27.1 | 75.5 | 1.4 | 122.6 | 0.0 |
| 8/17/2009 | 100.2 | 27.2 | 75.7 | 1.5 | 158.3 | 0.2 |
| 8/18/2009 | 100.2 | 27.5 | 72.2 | 1.4 | 186.4 | 0.0 |
| 8/19/2009 | 100.3 | 28.4 | 68.4 | 1.9 | 186.9 | 0.0 |
| 8/20/2009 | 100.3 | 28.1 | 69.2 | 2.0 | 184.8 | 0.0 |
| 8/21/2009 | 100.3 | 26.5 | 75.8 | 1.3 | 122.3 | 0.6 |
+-----------+---------------+------+-------------+------------+-----------+--------------+
For multiple excel files, you have to loop over all such files in a loop. There doesn't appear to have any other way out.