Info

この質問は閉じられています。 編集または回答するには再度開いてください。

add text to value of a plot, part 3

1 回表示 (過去 30 日間)
alpedhuez
alpedhuez 2020 年 5 月 26 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have a spreadsheet
column 1: January 3,4,5,...
column 2: 1,2,3,...
column 3; temperature of January 3,4,5,...
I would like to have a plot of
x-axis Day 1 (January 3), Day 2 (January 4),...
y-axis Temperature

回答 (1 件)

Sai Sri Pathuri
Sai Sri Pathuri 2020 年 5 月 29 日
You may use readtable, readmatrix, or readcell function to read the excel sheet.
plot(readMatrixOutput(:,2)) % Using second column of matrix as it has temperature values
% Change the labels of x-axis
xticklabels({'Day 1 (January 3)','Day 2 (January 4)','Day 3 (January 5)'})
Refer this link for documentation of xticklabels.
  2 件のコメント
alpedhuez
alpedhuez 2020 年 5 月 30 日
I wanted to generate labels such as "Day 1 (January 3)" using Matlab not manually.
Sai Sri Pathuri
Sai Sri Pathuri 2020 年 6 月 2 日
You may try datetick function. I am not sure of Day 1 (January 3) format, but you can generate January 3 format automatically

この質問は閉じられています。

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by