From: Benedikt Heudorfer on
Hey there!

I have measured data over 10 years saved in a txt file. The data is about flow rate. Each data entry is connected to a date (in dd.mm.yyyy). data is in column 4, date is in column 2 of the file. What I need to do is to sum up the data over every day to get a daily value.
So I have to extract daily data. Problem is that moment of measuring as well the interval (e.g. 10.30 - 11.00 - 11.30 - 12.44 - 13.44 ...) changes some times (due to measurement errors). So the time as well as the number of data per day changes permanently. So I need Matlab to identify the data as appendant to each other according to the date (!) and then to sum it up directly so i can save it on. Can you help?
From: Benedikt Heudorfer on
"Benedikt Heudorfer" <rawker_(a)web.de> wrote in message <hv7qh3$j3m$1(a)fred.mathworks.com>...
> Hey there!
>
> I have measured data over 10 years saved in a txt file. The data is about flow rate. Each data entry is connected to a date (in dd.mm.yyyy). data is in column 4, date is in column 2 of the file. What I need to do is to sum up the data over every day to get a daily value.
> So I have to extract daily data. Problem is that moment of measuring as well the interval (e.g. 10.30 - 11.00 - 11.30 - 12.44 - 13.44 ...) changes some times (due to measurement errors). So the time as well as the number of data per day changes permanently. So I need Matlab to identify the data as appendant to each other according to the date (!) and then to sum it up directly so i can save it on. Can you help?

Ok let me rephrase this. For every day in column 2, the accordant data in column 4 should be summed up.
For this, I think need a code to automatically identify the days out of the time-column 2... or something like that.
From: Benedikt Heudorfer on
"Benedikt Heudorfer" <rawker_(a)web.de> wrote in message <hv7vns$m2b$1(a)fred.mathworks.com>...
> "Benedikt Heudorfer" <rawker_(a)web.de> wrote in message <hv7qh3$j3m$1(a)fred.mathworks.com>...
> > Hey there!
> >
> > I have measured data over 10 years saved in a txt file. The data is about flow rate. Each data entry is connected to a date (in dd.mm.yyyy). data is in column 4, date is in column 2 of the file. What I need to do is to sum up the data over every day to get a daily value.
> > So I have to extract daily data. Problem is that moment of measuring as well the interval (e.g. 10.30 - 11.00 - 11.30 - 12.44 - 13.44 ...) changes some times (due to measurement errors). So the time as well as the number of data per day changes permanently. So I need Matlab to identify the data as appendant to each other according to the date (!) and then to sum it up directly so i can save it on. Can you help?
>
> Ok let me rephrase this. For every day in column 2, the accordant data in column 4 should be summed up.
> For this, I think need a code to automatically identify the days out of the time-column 2... or something like that.

Any hint would be helpful. E.g. which commands i couldtry. I'm really stuck here.
Thanks, Ben
From: TideMan on
On Jun 16, 2:50 am, "Benedikt Heudorfer" <rawk...(a)web.de> wrote:
> "Benedikt Heudorfer" <rawk...(a)web.de> wrote in message <hv7vns$m2...(a)fred..mathworks.com>...
> > "Benedikt Heudorfer" <rawk...(a)web.de> wrote in message <hv7qh3$j3...(a)fred.mathworks.com>...
> > > Hey there!
>
> > > I have measured data over 10 years saved in a txt file. The data is about flow rate. Each data entry is connected to a date (in dd.mm.yyyy). data is in column 4, date is in column 2 of the file. What I need to do is to sum up the data over every day to get a daily value.
> > > So I have to extract daily data. Problem is that moment of measuring as well the interval (e.g. 10.30 - 11.00 - 11.30 - 12.44 - 13.44 ...) changes some times (due to measurement errors). So the time as well as the number of data per day changes permanently. So I need Matlab to identify the data as appendant to each other according to the date (!) and then to sum it up directly so i can save it on. Can you help?
>
> > Ok let me rephrase this. For every day in column 2, the accordant data in column 4 should be summed up.
> > For this, I think need a code to automatically identify the days out of the time-column 2... or something like that.
>
> Any hint would be helpful. E.g. which commands i couldtry. I'm really stuck here.
> Thanks, Ben

1. Read the data into Matlab using textscan
2. Convert the dates to Matlab days using datenum
3. Use diff on the times to figure out the finish index of each day.
Adding 1 to this will give the start index of the next day.
4. Loop through the days, averaging between each start and finish
address.
From: dpb on
TideMan wrote:
> On Jun 16, 2:50 am, "Benedikt Heudorfer" <rawk...(a)web.de> wrote:
>> "Benedikt Heudorfer" <rawk...(a)web.de> wrote in message <hv7vns$m2...(a)fred.mathworks.com>...
>>> "Benedikt Heudorfer" <rawk...(a)web.de> wrote in message <hv7qh3$j3...(a)fred.mathworks.com>...
>>>> Hey there!
>>>> I have measured data over 10 years saved in a txt file. The data is about flow rate. Each data entry is connected to a date (in dd.mm.yyyy). data is in column 4, date is in column 2 of the file. What I need to do is to sum up the data over every day to get a daily value.
>>>> So I have to extract daily data. Problem is that moment of measuring as well the interval (e.g. 10.30 - 11.00 - 11.30 - 12.44 - 13.44 ...) changes some times (due to measurement errors). So the time as well as the number of data per day changes permanently. So I need Matlab to identify the data as appendant to each other according to the date (!) and then to sum it up directly so i can save it on. Can you help?
>>> Ok let me rephrase this. For every day in column 2, the accordant data in column 4 should be summed up.
>>> For this, I think need a code to automatically identify the days out of the time-column 2... or something like that.
>> Any hint would be helpful. E.g. which commands i couldtry. I'm really stuck here.
>> Thanks, Ben
>
> 1. Read the data into Matlab using textscan
> 2. Convert the dates to Matlab days using datenum
> 3. Use diff on the times to figure out the finish index of each day.
> Adding 1 to this will give the start index of the next day.
> 4. Loop through the days, averaging between each start and finish
> address.

Alternatively, since days are whole integers in datenum form, a unique()
operation on floor() would provide the individual days and an optional
index array for each set belong to each day that could be used as the
index for the sum() selection.

--
 |  Next  |  Last
Pages: 1 2
Prev: plotting
Next: tranforming table to matrix