Set x axis into hour
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a table with 2 columns: 1st column is Hour, and the other is other values. So, I want to make a plot with some values on the y axis, and the x axis will be time (hours). I want to start it from 11:00 PM (4/4/2015) until 9:00 PM (5/4/2015).
Can anyone help me?
Thanks :)
2 件のコメント
pfb
2015 年 4 月 18 日
not very clear. Is this a problem of tick labels? If this is the case, take a look at axes properties, in particular tick values and labels.
Or do you need to convert dates into numerical values? In that case you might need the "datenum" and "datestr" functions
採用された回答
Star Strider
2015 年 4 月 21 日
This is one possibility:
x = 1:24; % Create Data
y = randi([2 4], 1, length(x)); % Create Data
figure(1)
plot(x, y)
set(gca, 'XTick', [1:2:24], 'XTickLabel', rem([1:2:24]+10,24))
axis([1 23 0 5])
xlabel('Time (Hr)')
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!