Problem with a yyaxis plot

8 visualizzazioni (ultimi 30 giorni)
Bryan Andrade Andrade
Bryan Andrade Andrade il 13 Dic 2019
Modificato: Adam Danz il 17 Dic 2019
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...

Risposta accettata

Adam Danz
Adam Danz il 13 Dic 2019
Modificato: Adam Danz il 17 Dic 2019
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,___)

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by