MATLAB Answers

add text to value of a plot, part 3

2 views (last 30 days)
alpedhuez
alpedhuez on 26 May 2020
Commented: Sai Sri Pathuri on 2 Jun 2020
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

  0 Comments

Sign in to comment.

Answers (1)

Sai Sri Pathuri
Sai Sri Pathuri on 29 May 2020
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 Comments

alpedhuez
alpedhuez on 30 May 2020
I wanted to generate labels such as "Day 1 (January 3)" using Matlab not manually.
Sai Sri Pathuri
Sai Sri Pathuri on 2 Jun 2020
You may try datetick function. I am not sure of Day 1 (January 3) format, but you can generate January 3 format automatically

Sign in to comment.

Tags

Products


Release

R2020a

Translated by