How can I extract the time column of a timetable

조회 수: 48 (최근 30일)
Antonio Melieni
Antonio Melieni 2019년 4월 20일
댓글: Ali Afruzi 2022년 4월 1일
Hi,
I need to extrct the time column of a timetable as I need to manipulate it.
any Ideas?
  댓글 수: 3
Antonio Melieni
Antonio Melieni 2019년 4월 20일
what I needed was array.Time;
Peter Perkins
Peter Perkins 2019년 5월 3일
Just for the record, David was correct, except for one subtle point: the row times in a timetable are metadata, not one of the variables. You can access them by name in exactly the same way, though.
David created his timetable with a workspace variable named MeasurementTime, whose name the timetable picked up; that's why his row times were named Measurement time. The default name is Time, though.

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 4월 20일
편집: Andrei Bobrov 2019년 4월 20일
variant
a = rand(20,6);
date1 = datetime(2019,4,19) + hours(cumsum(70*rand(20,1)));
TT = array2timetable(a,'RowTimes',date1);
date_out = TT.Time;
  댓글 수: 2
Antonio Melieni
Antonio Melieni 2019년 4월 20일
thats it :)
Ali Afruzi
Ali Afruzi 2022년 4월 1일
In my case it was
date_out = TT.time2;

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Haris K.
Haris K. 2020년 5월 13일
You can also use directly:
TT = timetable(Temp,Pressure,WindSpeed,WindDirection, 'RowTimes',MeasurementTime)
datetime_vec = TT.Time

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by