Filter only specific month from date serial number
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
AA
el 16 de Mzo. de 2017
Respondida: Peter Perkins
el 16 de Mzo. de 2017
Hi guys, I got a column with a date serial number and I would like to filter only the month of march. What is the coding for that?
0 comentarios
Respuesta aceptada
Peter Perkins
el 16 de Mzo. de 2017
Unless you're using a version prior to R2014b, use datetimes:
>> dn = 736696 + 90*rand(10,1)
dn =
736755.016662924
736699.214051072
736772.421637528
736780.059392298
736757.086163937
736764.196611752
736762.881922131
736731.300431758
736754.993010116
736711.406801903
>> d = datetime(dn,'ConvertFrom','datenum')
d =
10×1 datetime array
01-Mar-2017 00:23:59
04-Jan-2017 05:08:14
18-Mar-2017 10:07:09
26-Mar-2017 01:25:31
03-Mar-2017 02:04:04
10-Mar-2017 04:43:07
08-Mar-2017 21:09:58
05-Feb-2017 07:12:37
28-Feb-2017 23:49:56
16-Jan-2017 09:45:47
>> (d.Month == 3)
ans =
10×1 logical array
1
0
1
1
1
1
1
0
0
0
Prior to 14b, use datevec.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Calendar en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!