From: Peter Smith on 28 Jul 2010 17:44 "someone" <someone(a)somewhere.net> wrote in message <i2q7kl$q4e$1(a)fred.mathworks.com>... > "Peter Smith" <fe09ae(a)mail.wbs.ac.uk> wrote in message <i2q6mp$osl$1(a)fred.mathworks.com>... > > Hi all, your help would be much appreciated on this matter. I have approximately 200,000 files containing stock data and i am trying to aggregate these into daily files. However the times of my files start from 07:30 proceed uptil 12:59 and then go from 01:00 to 06:00. Hi Someone Initially i extract tmpTime from a number of .csv files containing stock data. For example i have data on bids asks volume etc for a number of stocks. Each file is for one stock and all trading minutes of the day. I want basically to associate thisminuteOfDat with tmpTime when i create aggregate files which contain all stocks for 1 day. cheers
From: Walter Roberson on 28 Jul 2010 17:47 Peter Smith wrote: > Hi all, your help would be much appreciated on this matter. I have > approximately 200,000 files containing stock data and i am trying to > aggregate these into daily files. However the times of my files start > from 07:30 proceed uptil 12:59 and then go from 01:00 to 06:00. > > I want to ultimately change the times to "minutes past midnight" , i.e. > 08:00 will be recorded as 480. If you did not change to minutes past midnight, then it would be a straight-forward text substitution: ctime = char(tmpTime); tochange = ctime(:,1) == '0' & ctime(:,2) < '7'; ctime(tochange,2) = char(ctime(tochange,2) + 2); ctime(tochange,1) = '1'; tmpTime = cellstr(ctime); Or if you really want to change to minutes, then ctime = char(tmpTime); tochange = ctime(:,1) == '0' & ctime(:,2) < '7'; thisMinuteOfDay = (ctime(:,1) - '0') * 600 + ... (ctime(:,2) - '0') * 60 + ... (ctime(:,4) - '0') * 10 + ... (ctime(:,5) - '0); thisMinuteOfDay(tochange) = ThisMinuteOfDay(tochange) + 720;
From: Peter Smith on 28 Jul 2010 18:06 thanks Walter i will try that now
From: dpb on 28 Jul 2010 19:59 Peter Smith wrote: > thanks Walter i will try that now That seems awfully roundabout unless I'm missing something. If you have times thistime in hh:mm format, then as posted earlier, minutes=datenum(thistime,15)*24*60; % the engine will do what you asked for --
From: Walter Roberson on 28 Jul 2010 22:48 dpb wrote: > Peter Smith wrote: >> thanks Walter i will try that now > > That seems awfully roundabout unless I'm missing something. > > If you have times thistime in hh:mm format, then as posted earlier, > > minutes=datenum(thistime,15)*24*60; % the engine > > will do what you asked for What you are missing is that the times are given in a 12 hour clock format, 07:00 to 12:59 followed (one minute later) by 01:00 to 06:00. The OP has not given us enough information to know whether there was an AM/PM indicator. Doesn't really matter though, as the calculations can be done efficiently without it. The *600 and so on that I show in my code are efficient ways of converting the times without the overheads of sscanf() or num2str()
First
|
Prev
|
Pages: 1 2 Prev: Static Callback Methods? Next: Another exact simplification challenge |