From: Robin on
Hello,

I have a similar problem and am also pretty new to matlab. I would like to get clarification on getting the data into the format mentioned below by dpb

"Building from my previous posting that read the values into [d,t,am,r]". I didn't see this post.

Also, my data is over several days and I would like to get an average, first for the hour within each day and then get an average for each hour across days. Is there modification to the code below that could accomplish relatively easily?

Currently my data is in CSV file with data/hour and temperature.

Any help would be very much appreciated.

Thanks!

dpb <none(a)non.net> wrote in message <h90o4e$v9c$1(a)news.eternal-september.org>...
> Vinny wrote:
> ...
> > I have a large data set with two columns, one with the date, and the
> second with my data. I'm looking for a simple way to get an hourly
> average based on the hour as listed in my first column.
> ...
> > What I'd like to end up with is something like this:
> >
> > 04/06/2009 15:00:00 70.44
> > 04/06/2009 16:00:00 70.44
> > 04/06/2009 17:00:00 70.53
> ...
>
> Building from my previous posting that read the values into [d,t,am,r],
> I'd do something like
>
> for i=1:length(d)
> tmp=char(t(i)); % turn into character array
> h(i)=str2double(tmp(1:2)); % convert hours to double value
> end
> u = unique(h); % get list of hours
> for i=1:length(u)
> idx = find(h==u(i)); % row in array of hour
> a(i) = mean(r(idx)); % mean for the hour
> end
>
> --