Converting Timetable to Individual Columns

4 次查看(过去 30 天)
Hello, I am trying to convert my timetable into a table with hour, day, month, and year in separate columns. This is so I can create a plot of hour with respect too another variable, if you have any ideas they would be much appreciated, thank you.

采纳的回答

Shweta Singh
Shweta Singh 2018-6-19
Hi,
Since I don't have access to the data you are trying to convert, I am going to use the air quality data included with MATLAB. Here are the steps you can try:
% Create a timetable
indoors = readtable('indoors.csv');
indoors = table2timetable(indoors);
% access the 'Time' column; times is now a datetime
times = indoors.Time;
% Create table
times_table = table(times.Hour, times.Day, times.Month, times.Year);
% The variable names appears as Var1, Var2, ... They can be changed using Properties
times_table.Properties.VariableNames = {'Hour', 'Day', 'Month', 'Year'};
You can now add the rest of the variables from timetable to the table (times_table) to complete the conversion. Hope this helps!

更多回答(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