Problem with a yyaxis plot

6 次查看(过去 30 天)
Hi, i need your help: i´m trying to plot this code:
x = linspace(0,25); y = sin(x/2); yyaxis left plot(x,y);
I found this code in mathworks help, i dont know why i can´t run it. The error says:
Error using yyaxis
Axes argument must be a Cartesian Axes of type matlab.graphics.axis.Axes
Help me please.... how i could fix it? its my matlab problem or the code is wrong i don´t know help me...

采纳的回答

Adam Danz
Adam Danz 2019-12-13
编辑:Adam Danz 2019-12-17
You're missing a semicolon
x = linspace(0,25); y = sin(x/2); yyaxis left; plot(x,y);
% here ^
Or, better yet, use separate lines which greatly increases readability and error detection.
x = linspace(0,25);
y = sin(x/2);
yyaxis left %no semicolon needed this time
plot(x,y);
The error message appeared becaues Matlab interpreted your code as providing an axes input: yyaxis(ax,___)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by