フィルターのクリア

How can I create a time series with this data?

26 ビュー (過去 30 日間)
Javier
Javier 2017 年 6 月 8 日
回答済み: Peter Perkins 2017 年 6 月 9 日
Hello,
I am struggling when creating a time series in matlab with the function timeseries(data,time), I have my data as follows
data = [1 2 3 4]
I have parsed the time with the function _datetime() when that data happened as followed
orgTime = ['2017-06-06T14:03:33.075441Z','2017-06-06T14:04:14.430077Z','2017-06-06T14:05:01.071987Z']
t = datetime(orgTime ,'InputFormat','uuuu-MM-dd''T''HH:mm:ss.SS''Z','TimeZone','UTC')
t =
4×1 datetime array
06-Jun-2017 14:03:33
06-Jun-2017 14:04:14
06-Jun-2017 14:05:01
06-Jun-2017 14:05:41
Now I would like to create the time series with that data, but I get the error
timeSeriesS1 = timeseries(data',t)
Error using timeseries/init (line 221)
The second argument must be either the time vector or the time series name.
Error in timeseries (line 324)
this = init(this,varargin{:});
What am I doing wrong?
Thanks!

採用された回答

Javier
Javier 2017 年 6 月 8 日
I have figured it out, apparently it was that the format was not correct in my time vector, this makes it work
t = datestr (datetime(time,'InputFormat','uuuu-MM-dd''T''HH:mm:ss.SS''Z','TimeZone','UTC'),'yyyy-mm-dd HH:MM:SS')

その他の回答 (1 件)

Peter Perkins
Peter Perkins 2017 年 6 月 9 日
Javier, if you have R2016b or later, you might take a look at timetables, as an alternative to timeseries.

カテゴリ

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