how to define time matlab for bar graph
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to display the graph by time, but I can't define the time so the graph is incorrect.
this is time variables
ChargeTime=[14.25;14.30;14.35;14.40;14.45;14.50;14.55;15.00;
15.05;15.10;15.15;15.20;15.25;15.30;15.35;15.40;15.45;15.50;
15.55;16.00;16.05;16.10;16.15;16.20;16.25;16.30;16.35;16.40]
power [6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;0;0;0;0;0]
2 commentaires
Tiago Dias
le 2 Déc 2019
Hello, your ChargeTime is not time, is just a number.
If you are fine with being a number just do
plot(ChargeTime,power,'*')
If u need time with days and hours and minutes:
t1 = datetime('26-09-2018 00:00:00','Format','dd-MM-uuuu HH:mm:ss','Format','dd-MM-uuuu HH:mm:ss');
Réponses (1)
KALYAN ACHARJYA
le 2 Déc 2019
ChargeTime=[14.25;14.30;14.35;14.40;14.45;14.50;14.55;15.00;
15.05;15.10;15.15;15.20;15.25;15.30;15.35;15.40;15.45;15.50;
15.55;16.00;16.05;16.10;16.15;16.20;16.25;16.30;16.35;16.40];
power=[6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;0;0;0;0;0];
bar(power)
xticks([14.25;14.30;14.35;14.40;14.45;14.50;14.55;15.00;
15.05;15.10;15.15;15.20;15.25;15.30;15.35;15.40;15.45;15.50;
15.55;16.00;16.05;16.10;16.15;16.20;16.25;16.30;16.35;16.40])
xlim([14 16]);
This way?
3 commentaires
KALYAN ACHARJYA
le 2 Déc 2019
Modifié(e) : KALYAN ACHARJYA
le 2 Déc 2019
ChargeTime=[14.25;14.30;14.35;14.40;14.45;14.50;14.55;15.00;
15.05;15.10;15.15;15.20;15.25;15.30;15.35;15.40;15.45;15.50;
15.55;16.00;16.05;16.10;16.15;16.20;16.25;16.30;16.35;16.40];
power=[6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;6.6;0;0;0;0;0];
bar(power)
xticklabels({'14.25','14.30','14.35','14.40','14.45','14.50','14.55','15.00','15.05','15.10','15.15','15.20','15.25','15.30','15.35','15.40','15.45','15.50','15.55','16.00','16.05','16.10','16.15','16.20','16.25','16.30','16.35','16.40'})
Is this? If not can you show the expected results (you can use paint tool) or are you want time format in axis?
Voir également
Catégories
En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!