How to arrange datetime vertically

조회 수: 8 (최근 30일)
Lemea Akara
Lemea Akara 2021년 6월 29일
댓글: Lemea Akara 2021년 6월 29일
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.

채택된 답변

Rik
Rik 2021년 6월 29일
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

추가 답변 (1개)

KSSV
KSSV 2021년 6월 29일
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

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by