How can I convert cell to a timetable?

17 Ansichten (letzte 30 Tage)
Ashfaq Ahmed
Ashfaq Ahmed am 24 Mär. 2023
Bearbeitet: Walter Roberson am 24 Mär. 2023
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?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 24 Mär. 2023
Bearbeitet: Walter Roberson am 24 Mär. 2023
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);

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by