Not enough arguments error when I clearly supply enough arguments?
Show older comments
I have two functions
function coords = dart_gun01(n)
coords = normrnd(0,10,n,2);
end
and
function [total, tally, shots] = dart_score(n, f_dart)
shots = f_dart(n);
total = 0;
tally = zeros(1,4);
for i=1:n
r = (shots(i,1)^2 + shots(i,2)^2)^0.5;
if r < 1
total = total + 10;
tally(4) = tally(4) + 1;
else if r < 5
total = total + 5;
tally(3) = tally(3) + 1;
else if r < 10
total = total + 1;
tally(2) = tally(2) + 1;
else
tally(1) = tally(1) + 1;
end
end
end
They are meant to work together; the first function is inputted into the second as the argument f_dart. But when I try to call for example:
[total,tally,shots] = dart_score(10,dart_gun01);
I get a not enough arguments error with regards to the dart_gun01 function. I don't why this is happening. for a while is was not working, then it started working, and now it's not working and the whole time I have not changed anything. Why is this?
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Report Generator in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!