Why do I receive error "Not enough input Argument"? Error in CreatePoints (line 7) plotPoints = linspace(lowValue, highValue, 5);
古いコメントを表示
Hello, I writing a code to Linear-spaced points array. function. But I have a problem which is "not enough Arguments" More specifly error in Error in CreatePoints (line 7)
plotPoints = linspace(lowValue, highValue, 5);
.I am not sure if you know what is the problem,I have paste my written codes below.
Linear-spaced points array.
Construct a row array plotPoints with 5 values that are spaced linearly from lowValue to highValue. Hint: Use the linspace function.
Ex: If lowValue is 1 and highValue is 10, plotPoints is [1.0000, 3.2500, 5.5000, 7.7500, 10.0000]
function plotPoints = CreatePoints(lowValue, highValue)
% lowValue: Starting value in plotPoints
% highValue: Ending value in plotPoints
% Construct a row array plotPoints with 5 linear-spaced
% point from lowValue to highValue
plotPoints = linspace (lowValue, highValue,5);
end
採用された回答
その他の回答 (1 件)
You need to provide inputs to the function when you run it, i.e., you cannot just click on the green Run button because that does not supply any inputs to the function.
Example, in the command window (or in a separate m-file):
pts = CreatePoints(1,10)
2 件のコメント
Eve
2024 年 10 月 15 日
Walter Roberson
2024 年 10 月 15 日
編集済み: Walter Roberson
2024 年 10 月 15 日
You have to put the CreatePoints call at the correct place.
pts = CreatePoints(1,10)
function plotPoints = CreatePoints(lowValue, highValue)
% lowValue: Starting value in plotPoints
% highValue: Ending value in plotPoints
% Construct a row array plotPoints with 5 linear-spaced
% point from lowValue to highValue
plotPoints = linspace (lowValue, highValue,5);
end
Note that the overall code could not be named CreatePoints.m (that is, a script may not be named the same as a function inside the script.)
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
