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
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!
