Thanks a lot TideMan,
the reason i thought i would have to use a for loop, is that i need to create averages for each year, then go on to make averages for each day. why i say that the day number will be repeated 10 times is because i have 10 years of data, therefore jan 1st will occur 10 times. if i can manage to index it into 1996 Jan 1st, 1996 Jan 2nd.... 2006 dec 31st, then each half hour segment will occur only once in each day.
so i was under the impression that if i used a for loop to narrow it down to a year, then another to narrow it down to the day, then i can average each day in each year. I was hoping the for loop would identify the elements i wanted to average, then go on to identify the next set of element and so on.
another question... how come a bunch of '3D's popped up in this post. is that normal?
thanks again for your help!
dave
>
> Question 1:
> You've got the wrong end of the stick completely.
> You don't use a for loop here.
> You need to identify the elements of the matrix that satisfy your
> criterion and operate on those.
> For example, to get all the elements for 1996 to 2006, you do this:
> indx=3DA(:,2) >=3D 1996 & A(:,2) <=3D 2006;
> this produces a logical array which is true for elements that lie in
> the interval and false for those that do not.
> Then, to find the mean of the elements that qualify for column 21, you
> do this:
> M=3Dmean(A(indx,21));
>
> Question 2:
> If your data are at halfhourly intervals, then for the first 12 hours
> each day, the day number will be repeated 24 times. Where do you get
> 10 from?
