I want to generate a time vector

49 ビュー (過去 30 日間)
Prajwal Venkatesh
Prajwal Venkatesh 2020 年 1 月 24 日
コメント済み: Fangjun Jiang 2020 年 1 月 24 日
I want the vector to start from one value and end in one value
I should be able to specify the interval between them
so example
start = 6:30 AM
end = 3 PM
interval = 5.12 minutes

採用された回答

Star Strider
Star Strider 2020 年 1 月 24 日
start = datetime('6:30 AM', 'InputFormat','h:mm a');
finish = datetime('3:00 PM', 'InputFormat','h:mm a');
interval = minutes(5.12);
Vector = (start:interval:finish).';
Vector.Format = 'hh:mm:ss';
Vector =
100×1 datetime array
06:30:00
06:35:07
06:40:14
06:45:21
06:50:28
06:55:36
. . .
02:41:31
02:46:38
02:51:45
02:56:52

その他の回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2020 年 1 月 24 日
datetime([0,0,0,6,30,0]):minutes(5.12):datetime([0,0,0,15,0,0])
  2 件のコメント
Prajwal Venkatesh
Prajwal Venkatesh 2020 年 1 月 24 日
I dont want the date , month and year to be displayed
What is the solution for this
Fangjun Jiang
Fangjun Jiang 2020 年 1 月 24 日
datetime('6:30','format','HH:mm'):minutes(5.12):datetime('15:00','format','HH:mm')

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by