How to calculate the deviation or difference between two arrays of datetime?

조회 수: 9 (최근 30일)
Hello everybody,
I try to compare two timelines of the same event, to analyse the synchronicity.
dt= between( H , I,'time' );
I really have no idea how to do it, that I arcieve a new filfe consiting only the numeral deviation of each "row" (10 in this case)
I hope I desrpibed my problem good enough, files are attached. format is Time_Relative_hmsf_-
Thanks for help :)

채택된 답변

Mohammad Sami
Mohammad Sami 2023년 10월 4일
Here is something to start you off.
H = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1501395/H4L.txt');
L = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1501400/I4R.txt');
diff = L.Var1 - H.Var1
diff = 10×1 duration array
00:00:00.000 00:00:00.000 00:00:00.000 00:00:00.000 -00:00:00.040 00:00:00.000 -00:00:00.040 -00:00:00.040 00:00:00.000 00:00:00.000
  댓글 수: 2
Belinda
Belinda 2023년 10월 15일
Didn't recognize that it is that easy, thank you!
Siddharth Bhutiya
Siddharth Bhutiya 2023년 11월 1일
Since you are only reading vector of duration values from the files and you dont really need tables, this can be simplified further by using readmatrix.
H = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1501395/H4L.txt',OutputType='duration')
H = 10×1 duration array
00:03:21.720 00:03:22.560 00:03:23.440 00:03:24.280 00:03:25.160 00:03:26.040 00:03:26.920 00:03:27.800 00:03:28.640 00:03:29.480
L = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1501400/I4R.txt',OutputType='duration')
L = 10×1 duration array
00:03:21.720 00:03:22.560 00:03:23.440 00:03:24.280 00:03:25.120 00:03:26.040 00:03:26.880 00:03:27.760 00:03:28.640 00:03:29.480
L-H
ans = 10×1 duration array
00:00:00.000 00:00:00.000 00:00:00.000 00:00:00.000 -00:00:00.040 00:00:00.000 -00:00:00.040 -00:00:00.040 00:00:00.000 00:00:00.000

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by