changing the date format in matlab

1 回表示 (過去 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 Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by