not enough input argument error

2 views (last 30 days)
Maria
Maria on 3 Jun 2020
Answered: Steven Lord on 3 Jun 2020
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 ?

Accepted Answer

Image Analyst
Image Analyst on 3 Jun 2020
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 Comments
Maria
Maria on 3 Jun 2020
I ran it on command window here
Image Analyst
Image Analyst on 3 Jun 2020
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')

Sign in to comment.

More Answers (1)

Steven Lord
Steven Lord on 3 Jun 2020
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

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!