Why does "ts2timetable" produce error "The VariableUnits property must have one element for each variable in the table." in MATLAB R2021a Prerelease?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 16 de Feb. de 2021
Editada: MathWorks Support Team
el 2 de Mzo. de 2021
I have an array of timeseries objects. I would like to transform them into a timetable using the "ts2timetable" function. Specifically,
>> tt = ts2timetable(tsObj1, tsObj2, tsObj3);
However, I encountered an error:
Error using ts2timetable (line 83)
The VariableUnits property must have one element for each variable in the table.
Respuesta aceptada
MathWorks Support Team
el 2 de Mzo. de 2021
The error is related to the "DataInfo.Units" property in the timeseries objects.
Note that the timeseries objects that are used as inputs to "ts2timetable" must all have specified units for "DataInfo.Units", or all have empty DataInfo.Units.
If not, the error would be generated. For example, if tsObj1.DataInfo.Units = 'unit1' while tsObj2 and tsObj3 have empty DataInfo.Units, there would be an error.
To fix the error, set or unset DataInfo.Units for all timeseries objects. Using the above example, you can provide a unit to the second and third timeseries objects as follows:
>> tsObj2.DataInfo.Units = 'unit2';
>> tsObj3.DataInfo.Units = 'unit3';
>> tt = ts2timetable(tsObj1, tsObj2, tsObj3);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Time Series en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!