Clear Filters
Clear Filters

yline error for Matlab example

7 views (last 30 days)
Cakil on 18 Jan 2023
Commented: Star Strider on 18 Jan 2023
Hello Matlab Community,
I am having trouble to use yline command. Even if I try the matlab example, I receive the below error:
Code for example from yline documentation:
fplot(@(x) log(x));
xlim([0 15]);
ylim([0 4]);
Addition to my question, I also tried the xline example and received a similar error. The link of example from xline documentation:
What can I do to fix my line problem?
I am using matlab R2022b and it is newly updated.
Thank you in advance for your time and support.

Accepted Answer

Star Strider
Star Strider on 18 Jan 2023
First, you could have ‘overshadowed’ the line function somehow. To determine that, run this from a script or your Command Window:
which line -all
built-in (/MATLAB/toolbox/matlab/graphics/primitive/line) /MATLAB/toolbox/coder/half/@half/line.p % half method
The result should be similar to the displayed result. If it says anything else (particularly ‘line is a variable’ or something similar) that could be the problem. The solution would be to re-name the user function or variable.
If that is not the problem, try running these from a script or your Command Window:
rehash toolboxcache
If that still does not solve the problem, Contact Support.
Cakil on 18 Jan 2023
Hello @Star Strider, thank you for your support.
which line -all
rehash toolboxcache
solved my problem.
Thanks a lot!
Star Strider
Star Strider on 18 Jan 2023
As always, my pleasure!

Sign in to comment.

More Answers (0)


Find more on Startup and Shutdown in Help Center and File Exchange





Community Treasure Hunt

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

Start Hunting!