0

I have a matrix that has 3months of data or so..Its a 952x1 matrix with the elements in the following format(3 hourly )

   Aug-05-2015 03:00:00
   Aug-05-2015 06:00:00
   Aug-05-2015 09:00:00
   Aug-05-2015 12:00:00
   Aug-05-2015 15:00:00
   Aug-05-2015 18:00:00
   Aug-05-2015 21:00:00
   Aug-06-2015 00:00:00
   Aug-06-2015 03:00:00
   Aug-06-2015 06:00:00

I would want to choose say only day timings/ only night or say for august month alone. How do i do that.

Further to my question, if I have a group of .wav files and Im trying to pick only month wise or do daily psd averages etc or chose files belonging to a month how to go about? The following are first 10 .wav files in a .txt file that are read into matlab code-

AMAR168.1.20150823T200235Z.wav
AMAR168.1.20150823T201040Z.wav
AMAR168.1.20150823T201845Z.wav
AMAR168.1.20150823T202650Z.wav
AMAR168.1.20150823T203455Z.wav
AMAR168.1.20150823T204300Z.wav
AMAR168.1.20150823T205105Z.wav
AMAR168.1.20150823T205910Z.wav
AMAR168.1.20150823T210715Z.wav

yyyymmddTHHMMSSZ.wav is part of the format to get sense of some parameters.

Thanks.

1
  • 2
    What exactly is the format of the array? Are they time numbers? Strings? It's not clear from your question. Commented Aug 30, 2016 at 14:48

1 Answer 1

1

Are these datetimes? If so, you can use logical indexing here if you make use of some of the datetime functions. To get the times in August:

t = datetime(2015, 8, 1, 3, 0, 0) + hours(3:3:3000)';
t(month(t) == 8)  % Times in August

To get the times that are during the day or night:

t(hour(t) < 12)   % Day times
t(hour(t) >= 12)  % Night times
Sign up to request clarification or add additional context in comments.

2 Comments

And of course, you can combine these. Morning times in August: t((month(t) == 8) & (hour(t) < 12))
yes the class is datetime for this matrix. thanks a ton

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.