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

조회 수: 1 (최근 30일)
Rahul Bhadani
Rahul Bhadani 2015년 11월 27일
답변: Dave Behera 2015년 12월 4일
The way we call ros::Duration in C++, I need to call in Matlab. What its equivalent expression in MATLAB?
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2015년 11월 27일
Rahul - are you referring to the code found here ros::Duration Class Reference? See date and time operations for (perhaps) equivalent functionality 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