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

3 ビュー (過去 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)
  1 件のコメント
Tim Boxall
Tim Boxall 2021 年 3 月 12 日
This didn't make any difference for me.

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by