Stack Bar Plot: length error between x and y

조회 수: 2 (최근 30일)
Deborah Johnson
Deborah Johnson 2023년 1월 10일
댓글: Voss 2023년 1월 10일
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')

채택된 답변

Voss
Voss 2023년 1월 10일
Try this:
x = Book1.PickupTime;
y = [Book1.Manhattan Book1.LaGuardia Book1.JFK];
bar(x, y, 'stacked')
  댓글 수: 2
Deborah Johnson
Deborah Johnson 2023년 1월 10일
Thanks!
Voss
Voss 2023년 1월 10일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bar Plots에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by