How can I plot datetime as x-axis in pcolor ?
Afficher commentaires plus anciens
Hello Seniors,
I have time(datetime - 6047X1) need to be in x-axis, height(numeric value - 27X1) as y axis, C(27X6047) numeric values.
I am having error(Error using pcolor (line 65) Data inputs must be real.) while I want plot by using pcolor.
4 commentaires
Shubham Gupta
le 14 Oct 2019
what's the datatype for 'time', 'height' & 'C' ? If anyone of them is complex, then I think that might not be allowed for 'pcolor'.
Jeevan Kumar Bodaballa
le 14 Oct 2019
Shubham Gupta
le 14 Oct 2019
One of the way can be:
dt = [datetime('yesterday'),datetime('today'),datetime('tomorrow')];
y = 1:3;
C = [3 4 5; 1 2 5; 5 5 5];
pcolor(datenum(dt),1:3,C)
a = gca;
a.XTick = datenum(dt);
a.XTickLabel = datestr(datenum(dt));
I am not sure if that's what you want but let me know if you have doubts.
Jeevan Kumar Bodaballa
le 15 Oct 2019
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Axis Labels dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!