Not enough input arguments when they are already defined
2 views (last 30 days)
Show older comments
Hi,
I created a new function and function file "theiss", I need to call the function in another script "Part1" with defined input variables but keep getting "Not enough input arguements" on the "Part 1" file. I do not want to set default inputs on the original function. First code below is the function file with the name "theiss.m", then the next, seperate script "Part 1" is below it
thank you
function [ux] = theiss(r,S,T,t)
ux = theiss((r^2 *S)/(4 * T * t));
end
%Part1 which is a seperate script file
T = 4706;
S= 0.00072;
t = 14610 ;
r = 7500 ;
ux = theiss(7500,0.00072,4706,14610);
% I have also tried
T = 4706;
S= 0.00072;
t = 14610 ;
r = 7500 ;
[ux] = theiss(r,S,T,t)
0 Comments
Accepted Answer
Voss
on 11 Apr 2022
Your function theiss calls itself with one input; that's the reason for the error.
function [ux] = theiss(r,S,T,t)
% theiss calls theiss here, with one input, which has value (r^2 *S)/(4 * T * t):
ux = theiss((r^2 *S)/(4 * T * t));
% so in that call to theiss, arguments S, T, and t are not given and you get
% the error when it tries to do (r^2 *S)/(4 * T * t) for the next call to
% theiss ...
end
Perhaps the function should be defined as:
function [ux] = theiss(r,S,T,t)
% just calculate ux and return it
ux = (r^2 *S)/(4 * T * t);
end
More Answers (0)
See Also
Categories
Find more on Whos 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!