convert a vetor of hours into time

1 回表示 (過去 30 日間)
Richard
Richard 2012 年 3 月 13 日
I have a vector which shows hours of the day, it starts at 0 which corresponds to 00:00 and finishes at 23 which corresponds to 23:00. How can I change my original vector to be in the same format a their corresponding time i.e. HH:MM?

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 3 月 13 日
x = (0:23).';
n = numel(x);
out = datestr([ones(n,1)*[2012 3 10] x zeros(n,2)],'HH:MM');

その他の回答 (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