changing the date format in matlab

1 次查看(过去 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