Why do I receive error "Not enough input Argument"? Error in CreatePoints (line 7) plotPoints = linspace(lowValue, highValue, 5);
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (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 commentaires
Eve
le 15 Oct 2024
Walter Roberson
le 15 Oct 2024
Modifié(e) : Walter Roberson
le 15 Oct 2024
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.)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
