フィルターのクリア

Solve the error 'not enough input arguments'

1 回表示 (過去 30 日間)
Inti Vanmechelen
Inti Vanmechelen 2015 年 12 月 20 日
編集済み: John D'Errico 2015 年 12 月 20 日
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 件のコメント
David Young
David Young 2015 年 12 月 20 日
It would help if you showed the whole error message. You probably also need to show the code that calls the function.
Jan
Jan 2015 年 12 月 20 日
Edited: Code formatted properly.

サインインしてコメントする。

回答 (2 件)

Jan
Jan 2015 年 12 月 20 日
Let me guess: How do you call this function? Does the call contain all 4 input arguments?
EMGNor = findEMGNor(SmoothSignal, subjects, motion, EMGMax)

John D'Errico
John D'Errico 2015 年 12 月 20 日
編集済み: John D'Errico 2015 年 12 月 20 日
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

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by