user1769107
user1769107

Reputation: 265

Matlab error for input

What does this error mean in matlab? When I run the function on command window using 2 input images (the images are in tif format, floating point,32 bit and their size are (5165,11945,7)), matlab show me the following error message.

Undefined function or method (name of input image) for input arguments of type double.

Some people said that it is because of different woriking directory. But so far, I have only one working directory in matlab (c:\User\user\Documents\MATLAB\). All my images are in it. I can see them on matlab screen in the file list of current director icon. I'm really confused where this error comes from. Hope someone can help me.

Upvotes: 0

Views: 1178

Answers (1)

slayton
slayton

Reputation: 20319

Because Matlab uses parenthesis instead of square braces for vector/matrix indexing it cannot distinguish between variables and functions with the same name. For example in Java if you have an array and function both named foo, you access values in the array with:

foo[index];

And you would call the function with:

foo(parameter);

However in matlab indexing into the vector foo and calling the function foo are both done using the same syntax:

foo(someValue);

Because of this confusion, Matlab first assumes that all calls are to variables. If a variable with the specified name doesn't exist then it tries to find a function with the same name.

Your error:

Undefined function or method VariableName for input arguments of type double.

Indicates that Matlab thinks you are trying to call a function named VariableName. This means two things:

  1. There is NOT a variable named VariableName
  2. There is NOT a function named VariableName on your matlab path.

To rectify this problem, first determine if you are trying to index into a variable or call a function. Then ensure that either that variable exists or that the function is on your path.

Upvotes: 1

Related Questions