Prev: Locating GUIDE Gui Figure Handle/Passing Data
Next: image transfer using instrument control toolbox
From: Luna Moon on 31 May 2010 21:39 Hi all, Here are the data I am working on: dDataTmp2 is a Nx2 matrix, with the first column being the timestamps and the second column the data. K>> datestr(dDataTmp2(1, 1)) ans = 01-Apr-2010 00:19:00 I would like to compute the average of the second-column-data every M seconds, e.g. M=5, and put the results into a new smaller matrix. Of course I can do datestr on each timestamp and match the "seconds", but that's slow and I have to do this repetitively and iteratively on GB of data. So the faster approach is to directly operate on the date/time numbers; but I don't know how to operate on them. Anybody could think of some "the fastest" algorithms for this? Thank you!
From: TideMan on 31 May 2010 22:29 On Jun 1, 1:39 pm, Luna Moon <lunamoonm...(a)gmail.com> wrote: > Hi all, > > Here are the data I am working on: > > dDataTmp2 is a Nx2 matrix, with the first column being the timestamps > and the second column the data. > > K>> datestr(dDataTmp2(1, 1)) > > ans = > > 01-Apr-2010 00:19:00 > > I would like to compute the average of the second-column-data every M > seconds, e.g. M=5, and put the results into a new smaller matrix. > > Of course I can do datestr on each timestamp and match the "seconds", > but that's slow and I have to do this repetitively and iteratively on > GB of data. > > So the faster approach is to directly operate on the date/time > numbers; but I don't know how to operate on them. > > Anybody could think of some "the fastest" algorithms for this? > > Thank you! You omitted the most vital piece of information: are the data equispaced in time?
From: John D'Errico on 31 May 2010 23:18 Luna Moon <lunamoonmoon(a)gmail.com> wrote in message <357ca75a-8456-4100-9362-4e6c775cfa11(a)e21g2000vbl.googlegroups.com>... > Hi all, > > Here are the data I am working on: > > dDataTmp2 is a Nx2 matrix, with the first column being the timestamps > and the second column the data. > > K>> datestr(dDataTmp2(1, 1)) > > ans = > > 01-Apr-2010 00:19:00 > > I would like to compute the average of the second-column-data every M > seconds, e.g. M=5, and put the results into a new smaller matrix. > > Of course I can do datestr on each timestamp and match the "seconds", > but that's slow and I have to do this repetitively and iteratively on > GB of data. > > So the faster approach is to directly operate on the date/time > numbers; but I don't know how to operate on them. > > Anybody could think of some "the fastest" algorithms for this? > > Thank you! Use my consolidator function, keying on the indicator: floor(timestamps*24*60*12) for your averaging. This allows you to not worry if the data is equally or unequally spaced. Find consolidator on the FEX: http://www.mathworks.com/matlabcentral/fileexchange/8354 HTH, John
From: Luna Moon on 1 Jun 2010 08:19 On May 31, 10:29 pm, TideMan <mul...(a)gmail.com> wrote: > On Jun 1, 1:39 pm, Luna Moon <lunamoonm...(a)gmail.com> wrote: > > > > > Hi all, > > > Here are the data I am working on: > > > dDataTmp2 is a Nx2 matrix, with the first column being the timestamps > > and the second column the data. > > > K>> datestr(dDataTmp2(1, 1)) > > > ans = > > > 01-Apr-2010 00:19:00 > > > I would like to compute the average of the second-column-data every M > > seconds, e.g. M=5, and put the results into a new smaller matrix. > > > Of course I can do datestr on each timestamp and match the "seconds", > > but that's slow and I have to do this repetitively and iteratively on > > GB of data. > > > So the faster approach is to directly operate on the date/time > > numbers; but I don't know how to operate on them. > > > Anybody could think of some "the fastest" algorithms for this? > > > Thank you! > > You omitted the most vital piece of information: > are the data equispaced in time? Hi Tideman, No, the data are not equally spaced in time. Any more thoughts? Thanks a lot!
From: Luna Moon on 1 Jun 2010 08:34 On May 31, 11:18 pm, "John D'Errico" <woodch...(a)rochester.rr.com> wrote: > Luna Moon <lunamoonm...(a)gmail.com> wrote in message <357ca75a-8456-4100-9362-4e6c775cf...(a)e21g2000vbl.googlegroups.com>... > > Hi all, > > > Here are the data I am working on: > > > dDataTmp2 is a Nx2 matrix, with the first column being the timestamps > > and the second column the data. > > > K>> datestr(dDataTmp2(1, 1)) > > > ans = > > > 01-Apr-2010 00:19:00 > > > I would like to compute the average of the second-column-data every M > > seconds, e.g. M=5, and put the results into a new smaller matrix. > > > Of course I can do datestr on each timestamp and match the "seconds", > > but that's slow and I have to do this repetitively and iteratively on > > GB of data. > > > So the faster approach is to directly operate on the date/time > > numbers; but I don't know how to operate on them. > > > Anybody could think of some "the fastest" algorithms for this? > > > Thank you! > > Use my consolidator function, keying on the > indicator: > > floor(timestamps*24*60*12) > > for your averaging. This allows you to not worry > if the data is equally or unequally spaced. > > Find consolidator on the FEX: > > http://www.mathworks.com/matlabcentral/fileexchange/8354 > > HTH, > John Hi John, Thanks a lot! But after reading the help of Consolidator, I just couldn't figure out how to use it in the right way to solve my problem. Could you please elaborate a bit further? Thank you!
|
Next
|
Last
Pages: 1 2 Prev: Locating GUIDE Gui Figure Handle/Passing Data Next: image transfer using instrument control toolbox |