From: Ayotunde on 16 May 2010 02:07 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <1f9cefc9-e938-4fad-9af1-9cc61730e170(a)d12g2000vbr.googlegroups.com>... > I'd probably first remove duplicated rows. Then I'd need to figure > out what fraction corresponds to 5 minutes. Then I'd probably use > interp1() to resample at exactly 5 minute intervals. Sound reasonable? i assume you where responding to my post and yes this does sound reasonable, but following what you say i can remove duplicated rows using unique(data,'rows') but then figuring out what fraction corresponds to 5 minutes for me is not straightforward because daily observations start at 9.31 am and don't end till a random time around 4.20 pm. i guess i can use those times as 'edges' for histc but its all conjectures to me as all this is akin to putting me in the deep end of a pool when i cannot swim. I appreciate this is probably easy stuff so please go easy on me
From: Ayotunde on 16 May 2010 03:20 "us " <us(a)neurol.unizh.ch> wrote in message <hsn8fh$p29$1(a)fred.mathworks.com>... > "Ayotunde " <rhymer2k(a)yahoo.co.uk> wrote in message <hsn7a1$604$1(a)fred.mathworks.com>... > > "us " <us(a)neurol.unizh.ch> wrote in message <hsk6lv$7lp$1(a)fred.mathworks.com>... > > > "Ayotunde " > > > > my question is that i am trying to replicate the results a paper (article) and they have used 5 minute observations however as is visible from the example of the csv, my data is more frequent than every 5 minutes. How do i go about extracting data from every 5 minutes from about 9.30 am when observations start, till 4.20 pm. each csv i have is for a whole year as mentioned above so i'd like to do this for the whole year. > > > > thnx in advance > > > > > > a hint: > > > > > > help histc; > > > > > > us > > > > Thank you for your hint, i still don't see how histc will help me though. i havn't come across an example that uses time for the "edges". Also i've tried but i cannot deduce how i can use histc to create a new array with data from every 5 minutes > > well then... a small example... > > one of the solutions > > % the data > % - date strings... > d0=datenum(now); > ds=datestr(datenum(d0)+(0:10)/24); % <- D0 + 1hr * (0:10) > % the engine > t0=datenum(d0); % <- D0 > ts=datenum(t0+(0:10)/(.5*24)); % <- D0 + 2hr * (0:10) [there will be slack!] > td=datenum(ds); % <- DS converted to DATENUMs > [tx,tn]=histc(td,ts); > % the result > disp([tx.';tn.']); > %{ > 2 2 2 2 2 0 0 0 0 0 0 % <- #obs of TD in TS > 0 1 1 2 2 3 3 4 4 5 5 % <- index into TS > %} > > us thnx....using your example, i tried doing q1=unique(q,'rows' ); d0=datenum(1998,01,02,9,31,0); ds=datestr(datenum(d0)+(0.10/36)); t0=datenum(d0); >> ts=datenum(t0+(0:10)/(.5*36)); >> td=datenum(ds); >> [tx,tn]=histc(td,ts); >> disp([tx.';tn.']); and i ended up getting 1 0 0 0 0 0 0 0 0 0 0 1 i have a few questions though... is ds creating a sort of "interval" while ts creates the "edges"? so i am trying to calculate the number of intervals in ts? that is the best understanding i have of the sample code above. Also why did you divide (0.10) by 24? this seemed to create a 6 minute interval so i just tried to guess a number which would create the 5 minute interval i wanted. thnx in advance, sorry i know i'm really bad at this.
From: us on 16 May 2010 04:08 "Ayotunde " <rhymer2k(a)yahoo.co.uk> wrote in message <hso6bb$nhe$1(a)fred.mathworks.com>... > "us " <us(a)neurol.unizh.ch> wrote in message <hsn8fh$p29$1(a)fred.mathworks.com>... > > "Ayotunde " <rhymer2k(a)yahoo.co.uk> wrote in message <hsn7a1$604$1(a)fred.mathworks.com>... > > > "us " <us(a)neurol.unizh.ch> wrote in message <hsk6lv$7lp$1(a)fred.mathworks.com>... > > > > "Ayotunde " > > > > > my question is that i am trying to replicate the results a paper (article) and they have used 5 minute observations however as is visible from the example of the csv, my data is more frequent than every 5 minutes. How do i go about extracting data from every 5 minutes from about 9.30 am when observations start, till 4.20 pm. each csv i have is for a whole year as mentioned above so i'd like to do this for the whole year. > > > > > thnx in advance > > > > > > > > a hint: > > > > > > > > help histc; > > > > > > > > us > > > > > > Thank you for your hint, i still don't see how histc will help me though. i havn't come across an example that uses time for the "edges". Also i've tried but i cannot deduce how i can use histc to create a new array with data from every 5 minutes > > > > well then... a small example... > > > > one of the solutions > > > > % the data > > % - date strings... > > d0=datenum(now); > > ds=datestr(datenum(d0)+(0:10)/24); % <- D0 + 1hr * (0:10) > > % the engine > > t0=datenum(d0); % <- D0 > > ts=datenum(t0+(0:10)/(.5*24)); % <- D0 + 2hr * (0:10) [there will be slack!] > > td=datenum(ds); % <- DS converted to DATENUMs > > [tx,tn]=histc(td,ts); > > % the result > > disp([tx.';tn.']); > > %{ > > 2 2 2 2 2 0 0 0 0 0 0 % <- #obs of TD in TS > > 0 1 1 2 2 3 3 4 4 5 5 % <- index into TS > > %} > > > > us > > thnx....using your example, i tried doing > > q1=unique(q,'rows' ); > d0=datenum(1998,01,02,9,31,0); > ds=datestr(datenum(d0)+(0.10/36)); > t0=datenum(d0); > >> ts=datenum(t0+(0:10)/(.5*36)); > >> td=datenum(ds); > >> [tx,tn]=histc(td,ts); > >> disp([tx.';tn.']); > and i ended up getting .... > i have a few questions though... is ds creating a sort of "interval" while ts creates the "edges"? so i am trying to calculate the number of intervals in ts? that is the best understanding i have of the sample code above. Also why did you divide (0.10) by 24? this seemed to create a 6 minute interval so i just tried to guess a number which would create the 5 minute interval i wanted. thnx in advance, sorry i know i'm really bad at this. well... DS and TS both are exemplary(!) series; one with an arbitrary(!) intervall of one, the other one with an interval of two hours... as far as HISTC is concerned, learn about it here help histc; % and look at it using a small, comprehensive data set... v=[1:6,4.5,1.5]; [a,b]=histc(v,1:2:10) % a = 3 3 2 0 0 % b= 1 1 2 2 3 3 2 1 us
From: ImageAnalyst on 16 May 2010 09:22 Maybe I don't understand. Why do you have repeated rows in the first place? Are you taking several samples at exactly the same time (or faster than your system can increment the time stamp)? Why is there a variable time in between time samples? And can you tell me what time 729757.397002315 is exactly in regular human readable time?
From: us on 16 May 2010 10:29 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <3ee23d97-0e88-4d6a-8bb1-62dd641df69a(a)h11g2000vbo.googlegroups.com>... > Maybe I don't understand. Why do you have repeated rows in the first > place? Are you taking several samples at exactly the same time (or > faster than your system can increment the time stamp)? > > Why is there a variable time in between time samples? > > And can you tell me what time 729757.397002315 is exactly in regular > human readable time? one of the solutions datestr(729757.397002315) % ans = 02-Jan-1998 09:31:41 us
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Sorting Cell Array Next: help me with this in simulink: 1000 consecutive zero crossings |