Selecting two different periods for variable / calibration data

2 vues (au cours des 30 derniers jours)
Peter
Peter le 16 Août 2014
Commenté : Peter le 16 Août 2014
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

Réponse acceptée

Ahmet Cecen
Ahmet Cecen le 16 Août 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.
  1 commentaire
Peter
Peter le 16 Août 2014
Thank you for taking your time to help me out - it worked!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by