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