changing the date format in matlab

조회 수: 3 (최근 30일)
Stefanos Dimitrakopoulos
Stefanos Dimitrakopoulos 2020년 8월 30일
답변: dpb 2020년 8월 30일
Dear all,
I have the following quarterly data
'01/04/1947'
'01/07/1947'
'01/10/1947'
'01/01/1948'
'01/04/1948'
'01/07/1948'
'01/10/1948'
'01/01/1949'
'01/04/1949'
'01/07/1949'
'01/10/1949'
'01/01/1950'
'01/04/1950'
'01/07/1950'
'01/10/1950'
'01/01/1951'
'01/04/1951'
'01/07/1951'
'01/10/1951'
'01/01/1952'
'01/04/1952'
'01/07/1952'
'01/10/1952'
'01/01/1953'
'01/04/1953'
'01/07/1953'
'01/10/1953'
'01/01/1954'
'01/04/1954'
'01/07/1954'
'01/10/1954'
'01/01/1955'
'01/04/1955'
'01/07/1955'
'01/10/1955'
'01/01/1956'
'01/04/1956'
'01/07/1956'
'01/10/1956'
'01/01/1957'
up to 01/4/2017 and I want to get the following format
1947Q2
1947Q3
1947Q4
1948Q1
1948Q2
1948Q3
1948Q4
and so on.
Is that possible in matlab?
Best

채택된 답변

dpb
dpb 2020년 8월 30일
>> dt=datetime(ds(1:10),'InputFormat','dd/MM/yyyy','Format','yyyy''Q''Q')
dt =
10×1 datetime array
1947Q2
1947Q3
1947Q4
1948Q1
1948Q2
1948Q3
1948Q4
1949Q1
1949Q2
1949Q3
>>

추가 답변 (0개)

카테고리

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