Filter löschen
Filter löschen

Stack Bar Plot: length error between x and y

2 Ansichten (letzte 30 Tage)
Deborah Johnson
Deborah Johnson am 10 Jan. 2023
Kommentiert: Voss am 10 Jan. 2023
Hello, I am trying to do a stack plot per hour:min for 3 cities. I changed the datetime to only show HH:mm.
But now I am told there is a 'length issue' between x and y. I believe I understand but don't know
for sure. Do I need to change the datatype from double to single or something else? I was
able to do the stack plot in excel. Please assist.
Error using bar - X must be the same length as Y.
x = [Book1.PickupTime];
y = [Book1.Manhattan; Book1.LaGuardia; Book1.JFK];
bar(x, y, 'stacked')

Akzeptierte Antwort

Voss
Voss am 10 Jan. 2023
Try this:
x = Book1.PickupTime;
y = [Book1.Manhattan Book1.LaGuardia Book1.JFK];
bar(x, y, 'stacked')

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by