Azzera filtri
Azzera filtri

Converting Timetable to Individual Columns

3 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Shweta Singh
Shweta Singh il 19 Giu 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!

Più risposte (0)

Categorie

Scopri di più su Tables in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by