How to define a time array with equal increment

조회 수: 12 (최근 30일)
kdilhara
kdilhara 2015년 12월 3일
댓글: Star Strider 2015년 12월 3일
Hi I need to define a duration array with equal increments
for example duration = [00:00:00 00:05:00 00:10:00 00:15:00 00:20:00 00:25:00....................23:55:00]
how can I do this in MATLAB
Thanks

채택된 답변

Star Strider
Star Strider 2015년 12월 3일
One possibility:
start = fix(now);
increment = 5/(60*24); % Five-Minute Increments
time_vct = 0:increment:(1-increment); % Vector
time_str = datestr(start + time_vct, 'HH:MM:SS'); % Date Strings
ViewResult = [time_str(1:5,:); time_str(end-4:end,:)]
ViewResult =
00:00:00
00:05:00
00:10:00
00:15:00
00:20:00
23:35:00
23:40:00
23:45:00
23:50:00
23:55:00
  댓글 수: 2
kdilhara
kdilhara 2015년 12월 3일
thank you very much, this works
Star Strider
Star Strider 2015년 12월 3일
My pleasure!

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by