changing the date format in matlab
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Stefanos Dimitrakopoulos
am 30 Aug. 2020
Beantwortet: dpb
am 30 Aug. 2020
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
0 Kommentare
Akzeptierte Antwort
dpb
am 30 Aug. 2020
>> 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!