Selecting two different periods for variable / calibration data
2 views (last 30 days)
Show older comments
lets say I have a range of data between 1st Jan 2004 and 31st Dec 2007
Currently the script I am using uses the following code to select the calibration period:
A = find(T==datenum([2004 1 1 0 0 0])):find(T==datenum([2005 12 31 00 00 0]));
This uses data between 1/1/2004 and 31/12/2005 (or 12/31/2005 in American speak).
However, I wish to add an addition time period into this, so that A = 1/1/2004 to 31/12/2005 and at the same time includes 1/1/2006 to 6/6/2006
Matlab is certainly not a strong point of mine as you may have guessed - however I'm in urgeant need for my masters thesis so help is greatly appreciated!!
Many thanks,
P
0 Comments
Accepted Answer
Ahmet Cecen
on 16 Aug 2014
There are better ways to do this, but the way that needs the less thought and the way you would understand the fastest would be:
A1 = find(T==datenum([2004 1 1 0 0 0])):find(T==datenum([2005 12 31 00 00 0]));
A2 = find(T==datenum([2006 1 1 0 0 0])):find(T==datenum([2006 6 6 00 00 0]));
A=[A1 A2];
Of course A here is just a list of indices, so you will need to do something like Data=T(A,:) to get the actual data.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!