Borrar filtros
Borrar filtros

Converting Timetable to Individual Columns

3 visualizaciones (últimos 30 días)
Cameron Power
Cameron Power el 19 de Jun. de 2018
Comentada: Cameron Power el 19 de Jun. de 2018
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.

Respuesta aceptada

Shweta Singh
Shweta Singh el 19 de Jun. de 2018
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!

Más respuestas (0)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by