MATLAB: How can i resolve it not enough input arguments

please help to resolve it what's going wrong in it?

function demo(testdir, n, code)
for k = 1:n %getting error in it

Best Answer

  • Pass the right number of arguments in when you call it. Don't just hit the big green 'Run' button, call it from command line or a script or another function and pass in the arguments.
    If you are calling it without arguments how would you expect it to know what n is and didn't you consider that you haven't been able to tell it what n is and that you want to?!