What is Matlab equivalent of C++ ros::Duration() ?

1 次查看(过去 30 天)
The way we call ros::Duration in C++, I need to call in Matlab. What its equivalent expression in MATLAB?

采纳的回答

Dave Behera
Dave Behera 2015-12-4
As given in ros::Duration Class Reference, the duration object is created as:
ros::Duration five_seconds(5.0); //Duration of 5 seconds
A similar object can be created in MATLAB using 'duration' function:
>> d = duration(0,0,5)
d =
00:00:05
>> d2 = duration(0,0,4)
d2 =
00:00:04
>> d-d2
ans =
00:00:01
The duration function here is of form duration(hour, minute, second). Other ways to use duration can be found here:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Code Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by