Date Time to elapsed Time

조회 수: 8 (최근 30일)
Robin Karl
Robin Karl 2021년 10월 6일
댓글: Robin Karl 2021년 10월 6일
Hello there,
I am currently trying to convert the timestamp in a table to process time. I would like to set the first measuring point as t0 = 0 hours.
The table has 5151 entries. The time intervals between the measuring points are not constant.
This is how it looks at the moment:
Timestamp pO2
"09.21.2021 15:08:54" 101.525100000000
"09.21.2021 15:09:09" 101.416700000000
"09.21.2021 15:09:24" 101.188700000000
"09.21.2021 15:09:39" 101.080300000000
"..." "..."
This is how I would like it:
Time [h] pO2
0 101.525100000000
0,00416667 101.416700000000
0,00833333 101.188700000000
"...." "..."
Thanks in advance for the help!

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 10월 6일
Read in the times as datetimes. Then subtract the first time from all times.
T.Timestamp = T.Timestamp-T.Timestamp(1);
% Set format to hour
T.Timestamp.Format = 'h';
You can use readtable to read the data into MATLAB.
  댓글 수: 1
Robin Karl
Robin Karl 2021년 10월 6일
Thanks that worked perfect

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by