Re: Dataset Arrays or...?



"Robert " <river_doctor@xxxxxxxxxxx> wrote in message
<fn2jfl$b2b$1@xxxxxxxxxxxxxxxxxx>...
Ok, as a Newbie I seem to be getting stuck on the
underlying
structure of arrays etc. Data that I work with always
has a
time stamp in the first column and different measured
variables in subsequent columns. Although I need to
perform
statistics on the entire dataset, I also need summary
statistics over various time periods (e.g. monthly stats).

Daily data will be in the form:

2005/12/25 2.959
2005/12/26 2.894
2005/12/27 2.879
2005/12/28 2.894
2005/12/29 2.837
2005/12/30 2.775
2005/12/31 2.825
etc...

In an .m file I am loading such data using,

[date,Q] = textread(File,'%s %f','delimiter',',');

And see that I can separate the date fields using,

[y, m, d] = datevec(date);

I assumed that I would then concatenate my vectors (y m d
Q)
so that I could extract Q for the time period required
(e.g.
all Januaries). I would appreciate advice on whether I am
approaching this correctly and what method is best for the
summaries I require (e.g. subsets? using grouping?). I
have
tried too many things to list here but I am assuming that
this is very simple and someone could set me straight
right
away.

Many thanks.

try something like this:

% read in the data
data=textread('c:\data.txt','%s')

% split into dates and Q values
dates = data(1:2:end);
Q = data(2:2:end);

% get from cell into arrays
for i = 1:length(dates)
ymd(:,i) = sscanf(dates{i},'%d/%d/%d');
Qs(i) = sscanf(Q{i},'%f');
end;

% now you've got vectors for everything
years = ymd(1,:);
months = ymd(2,:);
days = ymd(3,:);
qvals = Qs(1,:);

.



Relevant Pages

  • Re: We have the pitching, what about offense?
    ... "As an engineer I've always enjoyed ... suggest you look it up in a statistics book. ... although I took a course in it in college and have used/read stats ... Pedroia will do next year. ...
    (alt.sports.baseball.bos-redsox)
  • RE: How to link tables via the field names themselves, not their c
    ... you can query the database to do what you want easily. ... There are approximately 30 different aspects (or statistics) which are ... Beacuse there are so many stats per contract, ...
    (microsoft.public.access.queries)
  • RE: How to link tables via the field names themselves, not their c
    ... you can query the database to do what you want easily. ... There are approximately 30 different aspects (or statistics) which are ... Mulitple audits are made per contract. ... Beacuse there are so many stats per contract, ...
    (microsoft.public.access.queries)
  • Re: Just Arod being Arod
    ... they will lead to better or worse statistics. ... Player B has very little heart, guts, and nerve. ... ARod has a hell of a long way to go to match Reggie in Yankee lore ... pitches, it's in his stats. ...
    (alt.sports.baseball.ny-yankees)
  • Re: [Bug 1806] New: disks stats not kept for DM (device mapper) devices
    ... This appears to be due to the fact that the stats are traced via ... > request structs which are not generated until below the device mapper ... > (only the BIO) it has no place to record the start time. ... how I/O statistics are managed. ...
    (Linux-Kernel)