Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

locate and change value

0 views
Skip to first unread message

Dave

unread,
Apr 25, 2009, 5:01:07 AM4/25/09
to
Hi all,

I have ordered data from about 10 years. each year is split into days (1 - 365 and 1- 366 for leap years) and each day is split into half hours. my problem is... due to some glitch the first half hour of each year has a day number higher than the day previous, i.e. the first half hour in 2003 is in day 366, and the first half hour of 2005 is in day 367 (due to 2004 being a leap year). i thought of trying to use an if loop and a for loop to pick out the year and then change the erroneous value in each case to 1, but i couldnt make either work, do any of you guys have any ideas??

the first column of the data is year, the second column of the data is the day number.

Matt Fig

unread,
Apr 25, 2009, 10:43:02 AM4/25/09
to
Use logical indexing.

X(X==366 | X==367) = 1

Dave

unread,
May 2, 2009, 4:59:02 AM5/2/09
to
> X(X==366 | X==367) = 1

sorry for the long silence...

this will pick out all of the day 366, but as i have 2 leap years in there i need to select day 366 only from non leap years. I tried to pick out the values in each year using a for loop and the 'find' function, but then when I came to change the value in the (row,col) array I had made it only returned (1,2) and i could only change that one value.

0 new messages