ERROR: Not enough input arguments.

조회 수: 1 (최근 30일)
Mary Evans
Mary Evans 2020년 9월 25일
답변: Star Strider 2020년 9월 25일
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.

채택된 답변

Star Strider
Star Strider 2020년 9월 25일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by