Error using bar (line 172) X must be same length as Y.

조회 수: 2 (최근 30일)
jinfeng huang
jinfeng huang 2019년 12월 11일
댓글: hicham oufettoul 2022년 3월 19일
i am trying to plot a bar graph as illustrated in https://nl.mathworks.com/help/matlab/ref/bar.html
with the example code:
x = 1990;
y = [10 20 30];
bar(x,y)
but I got the error as menitioned in the Title.
is there any solution for it?
  댓글 수: 3
Tim Boxall
Tim Boxall 2021년 3월 12일
Same for me, using R2017b. I copied the example code exactly and got the same error.
hicham oufettoul
hicham oufettoul 2022년 3월 19일
Hi dear brother I hope you find the answer, if yes let me know it please, and thank you

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

답변 (1개)

Stephan
Stephan 2020년 8월 17일
Transpose y:
x = 1990;
y = [10 20 30]';
bar(x,y)

카테고리

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

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by