Solve the error 'not enough input arguments'
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi guys, Anyone who can explain why I get the error 'not enough input arguments' in this function?
function[EMGNor] = findEMGNor(SmoothSignal,subjects,motion,EMGMax)
for i = 1:10
for k = 1:3
EMGNor.(subjects{i}).(motion{k}) = ...
SmoothSignal.(subjects{i}).(motion{k})(:,2:21) / (EMGMax.(subjects{i}));
end
end
end
I taught I defined all the input arguments I used.
Thank you
2 comentarios
David Young
el 20 de Dic. de 2015
It would help if you showed the whole error message. You probably also need to show the code that calls the function.
Respuestas (2)
Jan
el 20 de Dic. de 2015
Let me guess: How do you call this function? Does the call contain all 4 input arguments?
EMGNor = findEMGNor(SmoothSignal, subjects, motion, EMGMax)
0 comentarios
John D'Errico
el 20 de Dic. de 2015
Editada: John D'Errico
el 20 de Dic. de 2015
Just because you define a variable in the base workspace, does not mean it will be automatically passed into the function when you "run" it. This is not how functions work. For example, mean is a function in MATLAB, provided by TMW.
Look at the help for mean.
help mean
mean Average or mean value.
S = mean(X) is the mean value of the elements in X if X is a vector.
For matrices, S is a row vector containing the mean value of each
column.
So mean takes an argument X, and computes the mean. I'll define avariable called X. See what happens.
X = rand(1,10);
run mean
Not enough input arguments.
Error in mean (line 66)
[flag, omitnan] = parseInputs(flag, flag2, isFlag2Set);
Error in run (line 96)
evalin('caller', [script ';']);
Similarly, if I just type the command mean on the command line, it will again fail.
mean
Not enough input arguments.
Error in mean (line 66)
[flag, omitnan] = parseInputs(flag, flag2, isFlag2Set);
In fact, in order to compute the mean of a variable, you need to use it like this:
mx = mean(X)
mx =
0.62386
In fact, you can compute the mean of any array, NOT just an array called X.
mean(1:10)
ans =
5.5
0 comentarios
Ver también
Categorías
Más información sobre Numeric Types 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!