フィルターのクリア

Not enough input arguments when they are already defined

2 ビュー (過去 30 日間)
N/A
N/A 2022 年 4 月 11 日
コメント済み: Voss 2022 年 4 月 11 日
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)

採用された回答

Voss
Voss 2022 年 4 月 11 日
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
  2 件のコメント
N/A
N/A 2022 年 4 月 11 日
AH! I see my error, thank you for your help!
Voss
Voss 2022 年 4 月 11 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by