ERROR: Not enough input arguments.

1 visualización (últimos 30 días)
Mary Evans
Mary Evans el 25 de Sept. de 2020
Respondida: Star Strider el 25 de Sept. de 2020
When I call my function, I get this error:
% Not enough input arguments.
% Error in CalcMKJointProb (line 26)
% for row = 1:obsData %loop through rows
However, if I copy & paste everything in my function (besides the function statement, of course) into the command window, it executes correctly and gets the result I want. I am not sure why this is or how to fix it.

Respuesta aceptada

Star Strider
Star Strider el 25 de Sept. de 2020
That error could be thrown if ‘obsData’ is a variable that should be passed to your ‘CalcMKJointProb’ function as an argument, and is not. This could be the case if you attempt to run your function by clicking on the green Run triangle in the MATLAB Editor, rather than calling it from a script with the appropriate inputs.
The only other explanation for that error that occurs to me is that ‘obsData’ is a function that requires inputs and then returns something that your for loop uses to determine the number of iterations for ‘row’. If so, you need to call it with the appropriate arguments.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by