Reputation: 45
I have a huge database with readings taken at half an hour interval (no data gaps). I need to modify the data such that it has readings at 3 hour interval. Is it possible to delete 5 rows and skip one (and continue till the end) or can I just select every 6th data and write it to another array? Can someone help me with the code for any of the two options?
2005-01-01 03:00:00 0.23 (Retain or write to another array)
2005-01-01 03:30:00 0.28 (Delete)
2005-01-01 04:00:00 0.35 (Delete)
2005-01-01 04:30:00 0.42 (Delete)
2005-01-01 05:00:00 0.50 (Delete)
2005-01-01 05:30:00 0.57 (Delete)
2005-01-01 06:00:00 0.64 (Retain or write to another array)
2005-01-01 06:30:00 0.70 (Delete)
2005-01-01 07:00:00 0.75 (Delete)
2005-01-01 07:30:00 0.79 (Delete)
2005-01-01 08:00:00 0.80 (Delete)
2005-01-01 08:30:00 0.81 (Delete)
2005-01-01 09:00:00 0.79 (Retain or write to another array)
2005-01-01 09:30:00 0.76 (Delete)
and so on.....
Thanks! :)
Upvotes: 0
Views: 1306
Reputation: 74940
To choose every 6th data point (i.e. 1,7,13,...), you simply index as follows
reducedArray = originalArray(1:6:end);
Upvotes: 1