Error while extracting time table from Dataset with Enum signal
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
Brahmadev
2023년 10월 6일
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!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!