- Create a new variable to store the converted timetable.
- Use the array2timetable function to convert the Timeseries to an array. The first argument to the array2timetable function is the Timeseries array, and the second argument is a vector of row times. The row times can be a vector of datetime or duration values.
- Assign the output of the array2timetable function to the new variable.
Convert Timeseries to Timetable for an R202a version.
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
before Matlab version R2021b, how do we convert a Timeseries to a Timetable?
Can I also get the raw functionf file, so that I make a local function that does that conversion on my laptop?
0 Commenti
Risposte (1)
recent works
il 4 Set 2023
ts = timeseries(rand(5,1),[0 10 20 30 40]);
TT = array2timetable(ts,[0 10 20 30 40]);
This code creates a Timeseries array called ts with 5 data points, sampled at 10 second intervals. It then converts ts to a Timetable array called TT. The row times in TT are the same as the sample times in ts.
You can get the raw function file for the array2timetable function from the MathWorks website. The file is located in the following directory:
<MATLAB_ROOT>\toolbox\matlab\datafun\array2timetable.m
Once you have the function file, you can copy it to your laptop and create a local function that does the conversion.
Example
function TT = timeseries2timetable(ts)
% Convert a Timeseries to a Timetable
TT = array2timetable(ts,ts.Time);
end
This function takes a Timeseries array as input and returns a Timetable array as output. The output Timetable array has the same data as the input Timeseries array, and the row times are the same as the sample times in the input Timeseries array.
Vedere anche
Categorie
Scopri di più su Time Series in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!