Timeseries data in Matlab

1 回表示 (過去 30 日間)
Sarah Yun
Sarah Yun 2019 年 11 月 19 日
編集済み: JESUS DAVID ARIZA ROYETH 2019 年 12 月 8 日
Hi,
I have textfile .txt for temperature data over the past 50 years (attached as pic).
I want to plot it as timeseries data.
How can I do this?
What function should I use?
Thank you.
(Here is snippet of data. It goes on like this until year 2017).
(Smallest time unit is hour in 3 hour intervals)
(Temp is the dependent variable).

回答 (1 件)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019 年 11 月 19 日
try it:
[filename,folder]=uigetfile('*.txt','please select your txt file');
a=readtable(fullfile(folder,filename));
time=datetime([a{:,2:5} zeros(size(a,1),2)]);
temp=a{:,6};
figure;
plot(time,temp)
  3 件のコメント
JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019 年 11 月 19 日
編集済み: JESUS DAVID ARIZA ROYETH 2019 年 12 月 8 日
these zeros are the minutes and seconds that are set to 0 by default, please formally accept my answer.
Sarah Yun
Sarah Yun 2019 年 11 月 19 日
編集済み: Sarah Yun 2019 年 11 月 19 日
Hello. Please, one more question, then I will accept your answer.
I loaded this .txt file into Matlab.
Now I want to do the same for this - make timeseries.
(Var6 = Temp)
Smallest unit of time is 1 hour.
Can you suggest correct function?
Thank you.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeTime Series についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by