필터 지우기
필터 지우기

Create duration array template

조회 수: 1 (최근 30일)
Luis Eduardo Cofré Lizama
Luis Eduardo Cofré Lizama 2022년 7월 29일
댓글: Luis Eduardo Cofré Lizama 2022년 7월 29일
I need to create a duration array as below. However, instead of getting tx with a length of 720000, Im getting 7200000001?
The context is that I will create this array as a timestamp template to then match my recorded times (and corrsponding data) with the closest time in this template.
ti = duration('00:00:0.00','Format','hh:mm:ss.SSS');
tf = duration('02:00:0.00','Format','hh:mm:ss.SSS');
interval = milliseconds(0.010);
tx = ti:interval:tf;
Cheers

채택된 답변

Chunru
Chunru 2022년 7월 29일
ti = duration('00:00:0.00','Format','hh:mm:ss.SSS');
tf = duration('02:00:0.00','Format','hh:mm:ss.SSS');
interval = milliseconds(0.010);
% number of points
n = 2*3600/(0.01e-3)+1
n = 720000001
% to make 720000 points
interval = seconds(0.010);
tx = ti:interval:tf;
whos
Name Size Bytes Class Attributes cmdout 1x33 66 char interval 1x1 10 duration n 1x1 8 double tf 1x1 32 duration ti 1x1 32 duration tx 1x720001 5760032 duration
  댓글 수: 1
Luis Eduardo Cofré Lizama
Luis Eduardo Cofré Lizama 2022년 7월 29일
Many thanks, it was seconds not milliseconds!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by