function [BlockAvg, BlockConvert] = Average_N_Convert_inBlocks(BlockRaw)
% [BlockAvg] = Average_N_Convert_inBlocks(BlockRaw)
% To average counts within each time block and to unit convert from counts
% to number per cubic meter, by multiplying 60,000. Multipication rate from
% email from Livia Souza Freire in Oct 15/15
for i = 1:5 
    for q = 1:8
        temp_count = [];
        for k = 1:size(BlockRaw.D1,2)  
            temp = mean(double(BlockRaw.(['D',num2str(i)])(k).(['n',num2str(q)])));
            temp_count = [temp_count; temp]; 
        end
        BlockAvg.(['D',num2str(i)]).(['n',num2str(q)]) = temp_count; % in unit of counts
        BlockConvert.(['D',num2str(i)]).(['n',num2str(q)]) = temp_count*60000; % in unit of number per cubic meter
    end  
    BlockAvg.(['D',num2str(i)]).unit = 'counts per 30 minutes';
    BlockConvert.(['D',num2str(i)]).unit = '#/m^3 per 30 minutes';
end
display('%--- function Average_N_Convert_inBlocks() complete ----%');

end
