Incorrect number of inputs or outputs for function linspace
古いコメントを表示

8 件のコメント
clc
clear
x=0:pi/100:2*pi;
y=sin(x);
z=linspace(1,100)
The default for linspace() is 100 points.
If your linspace() is complaining then somehow you are getting a different linspace. What shows up for
which -all linspace
Tanveer Islam
2023 年 6 月 5 日
Tanveer Islam
2023 年 6 月 5 日
Star Strider
2023 年 6 月 5 日
It should be returning something similar to those in Walter’s Comment.
Run these from a script or your Command Window:
restoredefaultpath
rehash toolboxcache
Then try your original code again and report the results.
Torsten
2023 年 6 月 5 日
for further context, I did cut and paste the r2023 version from the original c folder to g recently.
That's temerarious.
Walter Roberson
2023 年 6 月 5 日
The MATLAB that you copied from C: to G: recently appears to not be complete. If you need it to be stored in G: drive you should remove the G: version and uninstall from C: and then use the installer to install into G: directly.
Tanveer Islam
2023 年 6 月 5 日
Torsten
2023 年 6 月 5 日
You should follow Walter's advice.
回答 (1 件)
Even if it is a matter of personal taste, for unit steps I usually prefer to do:
z1 = 1 : 100;
Nontheless, this should also work:
z2 = linspace(1, 100);
isequal(z1, z2)
Are you sure didn't create a function called linspace?
Have you tried to reset the path and clear the Workspace?
Try to restart Matlab and run it again.
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

