How to plot data as a time series in a figure

1 次查看(过去 30 天)
HI,
I have a text file and I would like to plot the data as a time series in a figure.

采纳的回答

Akira Agata
Akira Agata 2019-10-30
How about the following?
T = readtable('data.txt','HeaderLines',3,'ReadVariableNames',false);
T.Properties.VariableNames = {'TIME_BEGIN','TIME_END','TEMPERATURE'};
T.TIME_BEGIN = datetime(num2str(T.TIME_BEGIN),'Format','yyyyMMdd');
T.TIME_END = datetime(num2str(T.TIME_END),'Format','yyyyMMdd');
Time = reshape(T{:,{'TIME_BEGIN','TIME_END'}}',[],1);
Temperature = repelem(T.TEMPERATURE,2,1);
figure
plot(Time,Temperature)
ylabel('Temperature','FontSize',16)
temperature.png
  2 个评论
Haider Ali
Haider Ali 2019-10-30
Its good. If , I would like to increase the number of years on X-asix. THen what should I change?
Haider Ali
Haider Ali 2019-10-30
HI Akira,
I have sent you a message. I need to plot some more data. KIndly reply me back. Thanks a lot

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by