Hi everyone,
I ran into a problem by using the xline function.
My aim was to draw a vertical line for x=5 and planned to use the xline function but I got "Undefined function".
I find this strange as the function is on the help suggestions.
Can somebody help me with this issues?
Thankks to all who can help me.
Chiara

 Réponse acceptée

Star Strider
Star Strider le 7 Nov 2020

0 votes

The xline function was introduced in R2018b.
Try this:
figure
plot((0:8), rand(1,9))
hold on
plot([1 1]*5, ylim, '-r') % Draw A Red Vertical Line At ‘x=5’
hold off
.

4 commentaires

Chiara Lanzi
Chiara Lanzi le 7 Nov 2020
Hi, I have R2018a so that was the problem.
Anyway, thanks for your answer, now I can draw the vertical line.
Chiara
Star Strider
Star Strider le 7 Nov 2020
As always, my pleasure!
Rasmus  Johs Nielsen
Rasmus Johs Nielsen le 9 Mar 2021
Is it possible to add text to the line?
Star Strider
Star Strider le 9 Mar 2021
Rasmus Johs Nielsen — Probably. It depends on what you want to do, and where you want to place the text.
See the documentation on text for details.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by