フィルターのクリア

Display time on x axis

144 ビュー (過去 30 日間)
Vikas Saroha
Vikas Saroha 2019 年 9 月 11 日
コメント済み: Star Strider 2019 年 9 月 13 日
Hello !
I have some readings taken at different time. I want to plot these values against time with steps of 20 seconds. Time limit is from 00:00:00 to 23:59:59. How i can insert time format on X axis.

採用された回答

Star Strider
Star Strider 2019 年 9 月 11 日
It depends on what options you have.
For datetime arrays, see Plot Dates and Durations.
If you are using datenum date numbers and do not have datetime arrays, use the datetick function.
Note that the date and time formats for the two functions are (frustratingly) different, so a datetime format will not work with datetick, nor datetick format with datetime.
  2 件のコメント
Vikas Saroha
Vikas Saroha 2019 年 9 月 13 日
I have time(hh:mm:ss) in column 1 and data in column 2. I want to plot time against that data. please tell me how can I do it?
Star Strider
Star Strider 2019 年 9 月 13 日
I actually have no idea because you have not presented enough information.
Try this example:
A = {'01:12:45', 21; '12:34:56', 42; '13:14:15', 84}; % Create Array
t = datenum(A(:,1), 'HH:MM:SS');
data = [A{:,2}];
figure
plot(t, data)
datetick('x', 'HH:MM:SS', 'keeplimits')
You will have to adapt it to your own data. See the documentation on datenum and datetick for details.

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

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