Too many input arguments.
7 views (last 30 days)
Show older comments
Hi everyone, I have this fucntion and I get error during the running
function f = objCemaNeigesce(x,userdata)
Pt = userdata( :,1 ) ;
Tmoy = userdata( :,2 ) ;
Tmin = userdata( :,3 ) ;
Tmax = userdata( :,4 ) ;
lame_deau = userdata( :,5 ) ;
Zz = x.Zz ;
ZmedBV = x.ZmedBV ;
Beta = x.ZmedBV ;
gradT = x.gradT ;
Tf = x.Tf ;
Vmin = x.Vmin ;
QNBV = x.QNBV ;
[lame_deau,perf] = CemaNeige( Pt, lame_deau, Tmoy, Tmax, Tmin, Zz, ZmedBV, Beta, gradT, Tf, QNBV, Vmin);
f = perf(1) ;
Here is error I get :
>> objCemaNeigesce(x,userdata)
Error using CemaNeige
Too many input arguments.
Error in objCemaNeigesce (line 25)
[lame_deau,perf] = CemaNeige( Pt, lame_deau, x,
Tmoy, Tmax, Tmin, Zz, ZmedBV, Beta, gradT, Tf,
QNBV, Vmin);
Someone can help me?
Thank
2 Comments
Steven Lord
on 28 Jun 2022
You haven't showed us the definition of the CemaNeige function, but apparently from the error message it is not defined to accept 13 input arguments. It is defined to accept fewer than 13 inputs.
You're passing into CemaNeige the inputs you unpacked from the userdata input of objCemaNeigesce in a different order than they're arranged in userdata. To me that smells like it will cause a problem for users of objCemaNeigesce and/or CemaNeige at some point, where they'll pass the inputs into objCemaNeigesce in the order that CemaNeige expects or vice versa. At the very least one or both functions should have help text clearly indicating their calling signature.
Accepted Answer
dpb
on 29 Jun 2022
Edited: dpb
on 2 Jul 2022
So much for help, Steven!!! :) Doncha just love folks who don't document a thing...not.
function [lame_eau, CemaParam] = CemaNeige( Pt, Tmoy, Tmax, Tmin, Date, CemaParam )
Shows the function expects and requires precisely six (6) input arguments. No more, no less.
So, fix the calling function to match --
[lame_deau,perf] = CemaNeige(Pt, lame_deau, Tmoy, Tmax, Tmin, Zz, ZmedBV, Beta, gradT, Tf, QNBV, Vmin);
was your calling statement; I count 12 instead of 13 inputs, but either is more than six.
Some of the variables you passed seem to match up; whether the fact the names are the same is good enough to be sure they're actually the right ones is another issue, but there are a number you've put in the list that don't match up at all...
0 Comments
More Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!