Reputation: 4188
I want to have a for-loop, which goes through each entry in a Time Series Object.
Below are the properties of my timeseriesobject
, filename:ts
.
Common Properties:
Name: 'unnamed'
Time: [70001x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [70001x1 double]
DataInfo: [1x1 tsdata.datametadata]
How can I easily go through each time value pair inside a for-loop. I want to have access to the data value and to the time value, so that I can temporarily store it for calculations. I didn't find the exact syntax in the documentation to do this. Hope you can me help out!
For example/ what I'm looking for written in pseudo-code!
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)
Upvotes: 0
Views: 58
Reputation: 7751
Time series objects are to be used per se. No need to store them nor their content in some other variables.
For example
x = rand(5,1);
ts = timeseries(x)
D = ts.data;
T = ts.time;
D
and T
are plain vectors and can be accessed by D(3)
or ts.data(3)
.
Upvotes: 2