MATLAB: Problem with answer 15.2 Creating and Calling Functions: (4/6) Create and Call a Function, task 1 MATLAB Fundamentals

fundamentalsMATLABMATLAB and Simulink Student Suitematlab function

The problem asks us to modify the function call using two inputs. I put the answer as follows:
top5 = getLargestN(x,5)
i get a message 'error using exercise>getLargestN too many input arguments'.
The answer i solution is identical to one I gave. How do I move forward here?

Best Answer

Gareth - did you update the function signature as well so that it accepts two inputs? Presumably you have defined the function (with body) like
function [res] = getLargestN(x)
and you would need to change this to
function [res] = getLargestN(x,y)
% do something in code with y
so that the signature matches how you are calling it (when you pass in the x and 5).