constructing a time variable in matlab

41 ビュー (過去 30 日間)
ektor
ektor 2019 年 1 月 31 日
コメント済み: madhan ravi 2019 年 1 月 31 日
Dear all,
I have a matrix
data= [9 30 0
9 30 0
9 30 0
9 30 0
9 30 0
9 30 1
9 30 1
9 30 1
9 30 1
9 30 1];
The first colum is the hour, the second column is the minute and the third column is second
I want to merge these 3 columns so as to construct a time variable as follows
datanew= [9.300
9.300
9.300
9.300
9.300
9.301
9.301
9.301]
;
How Can I do that in matlab? Is there any code?
  1 件のコメント
madhan ravi
madhan ravi 2019 年 1 月 31 日
datetime() ?

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

採用された回答

KSSV
KSSV 2019 年 1 月 31 日
編集済み: KSSV 2019 年 1 月 31 日
Read about duration
iwant = duration(data) ;
Or you can simply use:
iwant = data(:,1)+data(:,2)/100+data(:,3)/1000

その他の回答 (0 件)

カテゴリ

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