Error in histogram plot including datetime
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi!
I want to plot a histogram in a plot which x-axis is a datetime vector. However i got this error:
Error in histogram (line 145)
[opts,passthrough,dispatch] = parseinput(args,firstaxesinput);
here is my code:
histogram(run(1:12), D1.Date(1:12));
the run vector is double and D1.Date is a datetime vector.
12×1 datetime array
1999-12-31
2000-01-03
2000-01-04
2000-01-05
2000-01-06
2000-01-07
2000-01-10
2000-01-11
2000-01-12
2000-01-13
2000-01-14
2000-01-18
any solution would be much appritiated.
0 Kommentare
Antworten (1)
Star Strider
am 20 Jan. 2019
You already appear to have the data you want to plot, so histogram may not be the correct choice.
Try this instead:
figure
bar(D1.Date(1:12), run(1:12))
That will plot your data to look like a histogram plot.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!