Hi, I have data that contains one columns for time and some columns for values of some variables the same as following (this is a part of my data):
A=[ ‘29/07/2014 08:00:00.000’ 152 28 2; ‘29/07/2014 08:00:01.000’ 100 20 8; ‘29/07/2014 08:00:02.000’ 201 45 7; ‘29/07/2014 08:00:03.000’ 149 23 6]
First, the start time, finish time and sample time (time interval) are given by user. I want to calculate the average value for each variable during each sample time that user specified. Suppose that user has given the following information: Start time: ‘29/07/2014 08:00:00.000’; Finish time: ‘29/07/2014 08:20:00.000’; Sample time: 5 ;% based on minute. I Finally want to have a set of data as the following:
F=[‘29/07/2014 08:00:00.000’ X1 Y1 Z1; ‘29/07/2014 08:05:00.000’ X2 Y2 Z2; ‘29/07/2014 08:10:00.000’ X3 Y3 Z3; ‘29/07/2014 08:15:00.000’ X4 Y4 Z4; ‘29/07/2014 08:20:00.000’ X5 Y5 Z5];
That for example X2 is the average of X values between ‘29/07/2014 08:00:00.000’ and ‘29/07/2014 08:05:00.000’ and X3 is the average of X values between ‘29/07/2014 08:05:00.000’ and ‘29/07/2014 08:10:00.000’. Would you please help me how can I do this?
Best Answer