How can I convert cell to a timetable?

조회 수: 16 (최근 30일)
Ashfaq Ahmed
Ashfaq Ahmed 2023년 3월 24일
편집: Walter Roberson 2023년 3월 24일
Hi all, I have a table that is consists of both double (temperature, salinity) and cell array (sampling time). But I want to convert the table into a time timetable making sure that the time column is no longer a cell array, rather it is in a datetime format = YY:MM:DD HH:MM:SS.
I have attached the .mat file. Can anyone please help?

채택된 답변

Walter Roberson
Walter Roberson 2023년 3월 24일
편집: Walter Roberson 2023년 3월 24일
times = datetime(YourCell{:,4}, 'InputFormat', "yyyy-MM-dd'T'hh:mm:ss'Z'", 'TimeZone', 'GMT');
data = table2timetable(cell2table(YourCell(:,[1:3,5:end])), 'RowTimes', times);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by