not enough input argument error

조회 수: 1 (최근 30일)
Maria
Maria 2020년 6월 3일
답변: Steven Lord 2020년 6월 3일
when I put( [1×128 double], 'E') as input argument it says that "Error using double. Not enough input argument. " What's wrong with it ?
  댓글 수: 1
madhan ravi
madhan ravi 2020년 6월 3일
We are not magicians , show the code.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2020년 6월 3일
If your function is called MyFunc() and it expects two variables, a 1x128 double vector and a single character, then you need to pass that, not the word double. When it sees "double" it's expecting to call the double() function which needs a variable to make into a double class.
dblVec = rand(1, 128); % A 1 x 128 vector of doubles
ch = 'E'; % A single character vector.
results = MyFunc(dblVec, ch)
  댓글 수: 4
Maria
Maria 2020년 6월 3일
I ran it on command window here
Image Analyst
Image Analyst 2020년 6월 3일
Like I said, you have to pass in something for the first argument. What do you want to pass it? How about just random numbers, like this:
>> r = rand(1, 128); % Or whatever you want.
>> scales(r, 'E')

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Steven Lord
Steven Lord 2020년 6월 3일
It seems like you're trying to call a function using the description of a variable from the Workspace window rather than the variable itself.
It's like you tried to define a variable named x that is a double array of size 1x10.
>> x = 1:10;
>> whos x
Name Size Bytes Class Attributes
x 1x10 80 double
In order to call a function like sin on it, you don't pass in the description of the variable:
>> sin(1x10 double)
sin(1x10 double)
Error: Invalid expression. Check for missing multiplication operator, missing or
unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead
of parentheses.
Instead you pass the variable itself. Note that after I do that, y becomes a 1x10 double just like x was and is. Each element of y is the sine of the corresponding element of x: y(1) is the sine of x(1), y(2) the sine of x(2), etc.
>> y = sin(x);
>> whos x y
Name Size Bytes Class Attributes
x 1x10 80 double
y 1x10 80 double

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by