MATLAB - 搜索和访问时间序列对象中的单个条目

MATLAB - Search and get access of single entrys in Time Series Objects

我想要一个 for 循环,它遍历时间序列对象中的每个条目。 以下是我的 timeseriesobject、文件名:ts 的属性。

Common Properties:
Name: 'unnamed'
Time: [70001x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [70001x1 double]
DataInfo: [1x1 tsdata.datametadata]

如何轻松遍历 for 循环中的每个时间值对。我想访问数据值和时间值,以便我可以临时存储它以供计算。我没有在文档中找到执行此操作的确切语法。希望你能帮帮我!

例如/我要用伪代码编写的内容!

dataValue = ts(22).data    (comment: data value from entry #22 of Time Series Object ts)  
TimeValue = ts(22).time    (comment: time value from entry #22 of Time Series Object ts)

将使用时间序列对象本身。无需将它们或它们的内容存储在其他一些变量中。

例如

x = rand(5,1);
ts = timeseries(x)

D = ts.data;
T = ts.time;

DT 是纯向量,可以通过 D(3)ts.data(3).

访问