How to arrange datetime vertically

8 visualizaciones (últimos 30 días)
Lemea Akara
Lemea Akara el 29 de Jun. de 2021
Comentada: Lemea Akara el 29 de Jun. de 2021
Hello, How can I make my datetime appear in rows. Say, 01/Feb/2012 to 31/Dec/2021. I tried using transpose but it did not work. I want the date to appear vertically showing every date from 01/Feb/2012 to 31/Dec/2021 instead of horizontally.

Respuesta aceptada

Rik
Rik el 29 de Jun. de 2021
Transpose should work as expected:
(datetime(2012,02,01):datetime(2021,12,31)).'
ans = 3622×1 datetime array
01-Feb-2012 02-Feb-2012 03-Feb-2012 04-Feb-2012 05-Feb-2012 06-Feb-2012 07-Feb-2012 08-Feb-2012 09-Feb-2012 10-Feb-2012 11-Feb-2012 12-Feb-2012 13-Feb-2012 14-Feb-2012 15-Feb-2012 16-Feb-2012 17-Feb-2012 18-Feb-2012 19-Feb-2012 20-Feb-2012 21-Feb-2012 22-Feb-2012 23-Feb-2012 24-Feb-2012 25-Feb-2012 26-Feb-2012 27-Feb-2012 28-Feb-2012 29-Feb-2012 01-Mar-2012

Más respuestas (1)

KSSV
KSSV el 29 de Jun. de 2021
t0 = datetime(2012,1,1) ;
t1 = datetime(2021,12,31) ;
t = (t0:t1)' ;
t(1:10)
ans = 10×1 datetime array
01-Jan-2012 02-Jan-2012 03-Jan-2012 04-Jan-2012 05-Jan-2012 06-Jan-2012 07-Jan-2012 08-Jan-2012 09-Jan-2012 10-Jan-2012

Categorías

Más información sobre Dates and Time en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by