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.