Borrar filtros
Borrar filtros

Error in histogram plot including datetime

2 visualizaciones (últimos 30 días)
Sonima
Sonima el 20 de En. de 2019
Respondida: Star Strider el 20 de En. de 2019
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.

Respuestas (1)

Star Strider
Star Strider el 20 de En. de 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.

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by