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

3 visualizaciones (últimos 30 días)
jinfeng huang
jinfeng huang el 11 de Dic. de 2019
Comentada: hicham oufettoul el 19 de Mzo. de 2022
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 comentarios
Tim Boxall
Tim Boxall el 12 de Mzo. de 2021
Same for me, using R2017b. I copied the example code exactly and got the same error.
hicham oufettoul
hicham oufettoul el 19 de Mzo. de 2022
Hi dear brother I hope you find the answer, if yes let me know it please, and thank you

Iniciar sesión para comentar.

Respuestas (1)

Stephan
Stephan el 17 de Ag. de 2020
Transpose y:
x = 1990;
y = [10 20 30]';
bar(x,y)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by