How do I import quarterly data from Excel

10 views (last 30 days)
Danielau
Danielau on 10 Nov 2021
Answered: dpb on 10 Nov 2021
Hi.
I have a quarterly data set from the period 1992Q1 - 2021Q2 and is unable to convert it into Matlab.
The purpose is to plot this with the quarterly time frame on the x-axis.
i have attached the the prober forumla and dataset
Hope you can help!!

Answers (1)

dpb
dpb on 10 Nov 2021
>> tQ=readtable('..\Answers\Data_QFE.xlsx');
>> tQ.Year=datetime(tQ.Year,'InputFormat','uuuuQQQ','Format','uuuuQQQ');
>> head(tQ)
ans =
8×2 table
Year P_KBH
______ ______
1992Q1 5658
1992Q2 5744.2
1992Q3 5780.8
1992Q4 5566.2
1993Q1 5280.9
1993Q2 5446.1
1993Q3 5827
1993Q4 5616.4
>>
Read the doc for datetime to all the formatting options.

Community Treasure Hunt

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

Start Hunting!