Undefined function 'xline' for input arguments of type 'double'.

Have been working on a project on my laptop and university computer and when I sent over my data the 'xline' function no longer worked on the matlab file and renders the error - "Undefined function 'xline' for input arguments of type 'double'." and is not working for any value of xline(x1) that I enter on the computer.

1 件のコメント

Setsuna Yuuki.
Setsuna Yuuki. 2020 年 12 月 1 日
Are you sure your arguments are valid?
%for example:
xline(1);

サインインしてコメントする。

 採用された回答

Jon
Jon 2020 年 12 月 1 日

3 投票

Is it possible that the university computer is running an outdated version of MATLAB? According to the documentation xline was introduced in 2018b. Type ver on the command line to see what version you are running. Otherwise it could be a path problem. Make sure that the directory where the xline.m file is found, e.g. C:\Program Files\MATLAB\R2020a\toolbox\matlab\specgraph\xline.m, is on the MATLAB path.

3 件のコメント

Jon
Jon 2020 年 12 月 1 日
編集済み: Jon 2020 年 12 月 1 日
If you can't solve the problem a work around would be to just plot for example
xval = 3; % or wherever you want your vertical line to be
bigY = 1000; % something that is bigger than your typical range of y values
plot(x,y,[xval;xval],[-bigY,bigY]) % assume x and y defined previously
ylim([0,10]); % set limits appropriately to clip off excess y values on vertical line
Jonah Bricknell
Jonah Bricknell 2020 年 12 月 1 日
Cheers Jon , this worked perfectly
Jon
Jon 2020 年 12 月 1 日
Excellent - glad to hear

サインインしてコメントする。

その他の回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 12 月 1 日

1 投票

xline() was introduced in R2018b. If you are using an older release, you will get this error.

3 件のコメント

Jonah Bricknell
Jonah Bricknell 2020 年 12 月 1 日
Oh that makes sence, have been stuck on this for a while.
Is there another way of making a vertical line from a chosen x value for an older version, along with other data on the same graph?
Jon
Jon 2020 年 12 月 1 日
please see my answer below
Jonah Bricknell
Jonah Bricknell 2020 年 12 月 1 日
Yeah checked your answer Jon;
Thanks Ameer

サインインしてコメントする。

製品

質問済み:

2020 年 12 月 1 日

コメント済み:

Jon
2020 年 12 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by