Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Why do I get the error message Error using calculate (line 2) Not enough input arguments.

2 vues (au cours des 30 derniers jours)
ali
ali le 28 Nov 2013
Clôturé : MATLAB Answer Bot le 20 Août 2021
function d = calculate(a, b, c) if b==0 a==b c==b; disp('Denominator is zero'); else end a= input('Please write a number'); b= input('Please write a number'); c= input('Please write a number'); x=((b-c)/(a-b))-(a/(c-b)); y=(5+(2*sqrt(a^2+b^2))/3)^(1/5)+(a/b); d=(x/y)-c;

Réponses (1)

Wayne King
Wayne King le 28 Nov 2013
Modifié(e) : Wayne King le 28 Nov 2013
You can't write a function definition that expects inputs a,b, and c and then only try to provide them with an input statement inside the function. If you want the user to actually input the values, then write the function defintion without inputs
function d = calculate
end
What would be better is to pull the input statements out of the function and then use those to capture what to input in the function.

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by