Problem with a yyaxis plot
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bryan Andrade Andrade
le 13 Déc 2019
Modifié(e) : Adam Danz
le 17 Déc 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...
0 commentaires
Réponse acceptée
Adam Danz
le 13 Déc 2019
Modifié(e) : Adam Danz
le 17 Déc 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,___)
0 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!