How to display the midnight time in the x-axis ?

조회 수: 1 (최근 30일)
Manoj
Manoj 2018년 7월 26일
댓글: Manoj 2018년 8월 2일
find the attachment of the excel sheet having time from PM to AM in the midnight? I need to plot the time on x-axis from PM to AM (like 19:23PM and 01:02AM)?
  댓글 수: 1
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 7월 26일
편집: KALYAN ACHARJYA 2018년 7월 26일
What about y axis? There is no 01:02AM time in csv file.

댓글을 달려면 로그인하십시오.

채택된 답변

jonas
jonas 2018년 7월 26일
편집: jonas 2018년 7월 26일
I assume you have some start date, which is here set to 2000-1-1.
time=dlmread('Time_S.csv')
t1 = datetime(2000,1,1)+hours(time)
y=rand(size(t1))
h=plot(t1,y)
xtickformat('HH:mm a')
The subsequent 'a' in the xtickformat specifies AM/PM format
  댓글 수: 3
jonas
jonas 2018년 7월 29일
편집: jonas 2018년 7월 29일
You cannot use the datetime format for pcolor. However, you can use this method instead.
Z=dlmread('sr_S.csv');
t=dlmread('Time_S.csv');
t = datetime(2000,1,1)+hours(t)
Y=dlmread('height.csv');
p1=pcolor(datenum(t),Y,Z);
colorbar
set(p1,'edgecolor','none')
datetick('x','HH:MMPM','keepticks')
It's unclear if you want to interpolate the data or not, but that's the general technique for tickformat.
Manoj
Manoj 2018년 8월 2일
okay thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by