Error while extracting time table from Dataset with Enum signal

8 Ansichten (letzte 30 Tage)
Geraldo Rebouças
Geraldo Rebouças am 15 Jun. 2022
Beantwortet: Brahmadev am 6 Okt. 2023
Hi,
I have a Simulink model that should operate at different modes (e.g. ON/OFF) according to varying load demands. So, I log these modes (and other signals) and export them to the workspace as a Simulink.SimulationData.Dataset object. When I run the code below:
SimOut = sim(MyModel);
MyDataSet = SimOut.logsout;
myTab = extractTimeTable(MyDataSet);
I get the following error:
Error using matlab.internal.tabular.extractTimetable
Unable to synchronize the specified data. To output data as a cell array, set 'OutputFormat' to 'cell-by-signal'.
Error in Simulink.SimulationData.Dataset/extractTimetable
Caused by:
Error using timetable/synchronize
All variables in input timetables must support missing values (e.g. floating point, categorical, datetime, duration, or text) when synchronizing using 'fillwithmissing'.
I don't get any errors if I remove the Enum signal or when I use the cell by signal output format, but I would prefer to have a single table instead.

Antworten (1)

Brahmadev
Brahmadev am 6 Okt. 2023
Hi Geraldo,
I understand that you would like to call the “extractTimetable” function for “Simulink.SimulationData.Dataset” datatype.
The function “extractTimetable” outputs in “timetable” format by default, this datatype takes a union of all signal data while padding missing values. Hence, it expects an input which supports missing values such as floating point, categorical, datetime, etc.
In MATLAB, enumeration data type does not support missing values. In order to solve this issue and extract the data into a single table, you can convert the Enum signal to a categorical or integer datatype before calling the "extractTimetable" function.
You can refer to the following MATLAB Answer for more information on converting Enumeration to integer datatype[AM1] :
Hope this helps!

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by