Not enough input arguments.

2 views (last 30 days)
Ron Alfia
Ron Alfia on 11 Aug 2015
Answered: Walter Roberson on 11 Aug 2015
It is the first time I try to define a function in Matlab and it doesnt seem to work, The error I am getting is not enough input argument .To make it simple I opened a new function and copied the second example from the documentation for defining functions(<http://www.mathworks.com/help/matlab/ref/function.html)>, clicked F5 and saved under stat. The message on the command window : ">> stat Error using stat (line 2) Not enough input arguments."
function [m,s] = stat(x)
n = length(x);
m = sum(x)/n;
s = sqrt(sum((x-m).^2/n));
end
I use Matlab R2013a

Accepted Answer

Walter Roberson
Walter Roberson on 11 Aug 2015
In order to execute the function properly you need to go to the command line and invoke it passing in an argument. For example at the command line type
stat(rand(1,50)*14+8)

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!