Timeseries names and tscollection always empty of datas

7 views (last 30 days)
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.

Answers (1)

Jim Riggs
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
planet86_Chris
planet86_Chris on 29 Apr 2018
Hello Jim,
Thank you for your feedback. I now understand the way it works.
Then, when I create a tscollection (say that we have two times series, sensor 1 and sensor 2), my collection only contains basic information, time vector and the length of the time vector.
I cannot find the signal of the sensors in this object. Is it because it is only referencing to the time series ?
Thank you for your reply.
Jim Riggs
Jim Riggs on 29 Apr 2018
Edited: Jim Riggs on 29 Apr 2018
You need to post your code to show how you created the time series.
Also, how are you trying to retrieve the data from the time series.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!