Timeseries names and tscollection always empty of datas
7 views (last 30 days)
Show older comments
Hello everyone,
I have recently discovered the use of the timeseries and the collection of the timeseries. This is perfect as I am starting to have quite a lot of datas to handle from acquisitions. However, few times after coding, either I am making mistake on the use, or I am not seeing any functional purposes to use timeseries (I hope that I am mistaking, it should have a trick...).
Let's go.
- Timeseries
Says that we have a time vector, and signals from 2 sensors. So Ok, I would write the code in this way, simply:
if true ts = timeseries('data', sensorsMatrix, 'time', timeVectors, 'name', 'NameTimeseries') end
== > Ok fine I have created a time series, but I got frustrated...
-The name of the times series are Data1 and Data2... I did not find any way to modify it (I am not talking about the name of the time series, but the name of column which represents sensor 1 signal and sensor 2 signal) We are in the basis of handling datas...any help ?
-To add a third signal. Do we really have to add sample by sample... (in writing a script it takes fraction to handle matrix and vectors...), any help to add a third data columns ?
- Tscollection
So well, then I wanted to start to use the tscollection. tscollection1 = tscollection(ts) The issue I have is clear, when I adds a timeseries, I cannot find back any signals in the structure of the object...
I thank you very much for guiding to the light those points.
0 Comments
Answers (1)
Jim Riggs
on 26 Apr 2018
Edited: Jim Riggs
on 26 Apr 2018
When you save data as a time series, Matlab creates a structure which contains your output data. You select the name (e.g. "MyOutput") of the structure in the Simulink block (and filename if saving to a file). This structure contains five fields:
MyOutput.Name
MyOutput.Time
MyOutput.TimeInfo
MyOutput.Data
MyOutput.DataInfo
You probably only care about MyOutput.Time and MyOutput.Data.
MyOutput.Time is a vector of the time samples (let's say it contains n samples).
MyOutput.Data is an n x m matrix contains n samples of your m output signals. These signals are in the order that they are presented to the output block. Note that the output block only accepts a single input signal, so if you want to save more than one, signal (m > 1), they must be concatenated together into a single (multidimensional) signal before they go into the output block. So MyOutput.Data contains these m signals in the order that you assemble them. Data(:,1) is a vector containing n samples of the first output, Data(:,2) is a vector of n samples of the second one, etc.
3 Comments
See Also
Categories
Find more on Time Series Collections in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!