Selecting two different periods for variable / calibration data

2 ビュー (過去 30 日間)
Peter
Peter 2014 年 8 月 16 日
コメント済み: Peter 2014 年 8 月 16 日
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

採用された回答

Ahmet Cecen
Ahmet Cecen 2014 年 8 月 16 日
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 件のコメント
Peter
Peter 2014 年 8 月 16 日
Thank you for taking your time to help me out - it worked!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by