필터 지우기
필터 지우기

Converting Timetable to Individual Columns

조회 수: 3 (최근 30일)
Cameron Power
Cameron Power 2018년 6월 19일
댓글: Cameron Power 2018년 6월 19일
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