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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by