Getting relative time from two events identified as absolute time

4 views (last 30 days)
Hello, I haver a time event (AbsTime) reported as a double and I want to pull out the time since the 1st event (E0)
How can I report out this - thanks
events =
1×6 struct array with fields:
Type
Data
ans =
struct with fields:
AbsTime: [2025.00 2.00 10.00 20.00 16.00 8.34]
FrameNumber: 0
RelativeFrame: 0
TriggerIndex: 0
ans =
struct with fields:
AbsTime: [2025.00 2.00 10.00 20.00 16.00 11.90]
FrameNumber: 0
RelativeFrame: 0
TriggerIndex: 1.00
ans =
struct with fields:
AbsTime: [2025.00 2.00 10.00 20.00 17.00 11.90]
FrameNumber: 1.00
RelativeFrame: 0
TriggerIndex: 2.00
ans =
struct with fields:
AbsTime: [2025.00 2.00 10.00 20.00 18.00 6.60]
FrameNumber: 2.00
RelativeFrame: 0
TriggerIndex: 3.00
ans =
struct with fields:
AbsTime: [2025.00 2.00 10.00 20.00 19.00 1.09]
FrameNumber: 4.00
RelativeFrame: 0
TriggerIndex: 4.00
ans =
struct with fields:
E0 =
2025.00 2.00 10.00 20.00 16.00 8.34
ans =
'double'
E1 =
2025.00 2.00 10.00 20.00 19.00 1.09
ans =
0 0 0 0 3.00 -7.26
>>
This is how I actually get it:(and I Thought (E5-E0) would do it.
events = vid.EventLog %Events log from video object
format bank
E0=events(1).Data.AbsTime
class(E0)
E5=events(5).Data.AbsTime
E5-E0

Accepted Answer

Walter Roberson
Walter Roberson on 10 Feb 2025
elapsed_as_duration = datetime(E5) - datetime(E0);
Now you can ask things such as
seconds(elasped_as_duration)

More Answers (0)

Categories

Find more on COM Component Integration in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!