Too many arguments with lsline even using Matlab example

1 回表示 (過去 30 日間)
mashtine
mashtine 2015 年 1 月 20 日
コメント済み: mashtine 2015 年 1 月 20 日
Hi everyone,
Strangely, using the code given by Matlab for lsline, I get the too many arguments error. Any ideas? Probably one of those simple code issues that just take forever to figure out!! (for me at least)
rng default % For reproducibility
x = 1:10;
y1 = x + randn(1,10);
y2 = 2*x + randn(1,10);
figure
ax1 = subplot(2,1,1);
ax2 = subplot(2,1,2);
scatter(ax1,x,y1)
scatter(ax2,x,y2)
lsline(ax1)

採用された回答

Jorik
Jorik 2015 年 1 月 20 日
Are you using R2014b? In R2014a and older, lsline did not accept an input argument. The error message then makes sense. Maybe you used the online (R2014b) documentation, but you are using a different MATLAB release?
The R2014a documentation is also available, but it does not include an equivalent example: http://www.mathworks.com/help/releases/R2014a/stats/lsline.html
  1 件のコメント
mashtine
mashtine 2015 年 1 月 20 日
Ahh, thank you Jorik and Andreas. I am using Matlab R2013b. Lsline works but as you said, does not take arguments. Thanks!

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

その他の回答 (1 件)

Andreas Goser
Andreas Goser 2015 年 1 月 20 日
編集済み: Andreas Goser 2015 年 1 月 20 日
This code example runs in my R2104b, Win64 installation.
The question is in which line you get the error?
Take the function(s) from that line and try the
which functionname -all
command on them. Maybe the effect is caused by you having another function or variable shadowing.
  2 件のコメント
mashtine
mashtine 2015 年 1 月 20 日
Hi Andreas,
The function line is not defined in the error. I tried it with
dbstop if error
but that did not catch it either. Simply says too many arguments.
Andreas Goser
Andreas Goser 2015 年 1 月 20 日
Assuming in your last comment you wrote line instead of lsline:
which lsline -all
should return something like:
C:\Program Files\MATLAB\R2014b\toolbox\stats\stats\lsline.m
Which means the command is part of the Statistics Toolbox. Please verify with the command
ver
If you have that product installed.

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

Community Treasure Hunt

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

Start Hunting!

Translated by