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

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 commentaire

KALYAN ACHARJYA
KALYAN ACHARJYA le 26 Juil 2018
Modifié(e) : KALYAN ACHARJYA le 26 Juil 2018
What about y axis? There is no 01:02AM time in csv file.

Connectez-vous pour commenter.

 Réponse acceptée

jonas
jonas le 26 Juil 2018
Modifié(e) : jonas le 26 Juil 2018
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 commentaires

Manoj
Manoj le 29 Juil 2018
Thank you this time should be displayed on the pcolor type image Find the attached data , need x-axis (time), y-axis (height), z-axis (sr_S)
jonas
jonas le 29 Juil 2018
Modifié(e) : jonas le 29 Juil 2018
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 le 2 Août 2018
okay thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Question posée :

le 26 Juil 2018

Commenté :

le 2 Août 2018

Community Treasure Hunt

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

Start Hunting!

Translated by