From: Ryan Utz on
Hi all,

I have data in a time series that look like this:

1960 11 29 11.7
1960 11 30 11.1
1960 12 1 10
1960 12 2 9.4
1960 12 3 8.9

Where the format is year, month, day and data in a matrix. I need to find some basic stats on the data for each month. I've tried tinkering with codes I've written previously using things like 'find' and 'ismember' functions, but I can't seem to get to the bottom of it. I can easily make a matrix that is the unique year/month combination but can't seem to link these to the actual data to get the basic stats. Any advice?

Thanks,
Ryan
From: Ryan Utz on
Also, I am aware of the 'consolidator' function file, but am hoping not to rely on it in order to minimize the number of required working files I'm dealing with.
From: Alan B on
"Ryan Utz" <rutz(a)al.umces.edu> wrote in message <he495r$3nb$1(a)fred.mathworks.com>...
> Hi all,
>
> I have data in a time series that look like this:
>
> 1960 11 29 11.7
> 1960 11 30 11.1
> 1960 12 1 10
> 1960 12 2 9.4
> 1960 12 3 8.9
>
> Where the format is year, month, day and data in a matrix. I need to find some basic stats on the data for each month. I've tried tinkering with codes I've written previously using things like 'find' and 'ismember' functions, but I can't seem to get to the bottom of it. I can easily make a matrix that is the unique year/month combination but can't seem to link these to the actual data to get the basic stats. Any advice?
>
> Thanks,
> Ryan

You can do something like this to identify the rows of interest:

monthInds = data(:,1)==1960 & data(:,2)==12;

then, to look at the relevant data:

monthMean = mean(data(monthInds,4));

Are you trying to do something more involved than this?
From: Bruno Luong on
Use UNIQUE (on the columns year/mont) + ACCUMARRAY on the index.

Bruno
From: Ryan Utz on
I'm trying to do this on 40+ years, so was hoping to get stats (mean, min, max) on each month. So I guess yes, I was looking for something kind of complex. I have used accumarray before... but thought it just summed the data of interest (i.e. accumulate). Can it be used to find basic stats, too?
 |  Next  |  Last
Pages: 1 2
Prev: 2D plot of surface slice
Next: problem with mimochan