Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

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

Asked by D

D (view profile)

on 10 Apr 2011
Latest activity Edited by Eyasu getahun Chekole on 19 Apr 2015 at 11:46

I'm getting the following error when I try to run some function m-files: ??? Undefined function or method '[name of function]' for input arguments of type 'double'.

I know this usually happens when the file isn't in the working directory, but that's not the case here.

When I was running these m-files in a different directory on my computer, it worked fine. I moved them to another directory on my laptop, and they're still fine, but I get this error on two of my desktops.

Thank you.

0 Comments

D

D (view profile)

Products

No products are associated with this question.

8 Answers

Answer by Walter Roberson

Walter Roberson (view profile)

on 11 Apr 2011

Are you function names in mixed case, and your laptop runs Windows but your desktop runs Linux ?

2 Comments

D

D (view profile)

on 11 Apr 2011

Yes, the function names are mixed case.

The laptop and one of the desktops run Windows 7.
The other one is a Mac.

I get the same errors on both desktops, though.

Niklas

Niklas (view profile)

on 13 Mar 2014

Remember that the first function of the .m-file must have the same name as the file itself.

Walter Roberson

Walter Roberson (view profile)

Answer by Paulo Silva

Paulo Silva (view profile)

on 10 Apr 2011

change the working directory to the folder where you have your code or add the path.

Go to the File and choose the Set Path

2 Comments

D

D (view profile)

on 10 Apr 2011

That's not the problem. The file is in the working directory.

I've tried running it from the editor, but I'm getting the same error.

Oleg Komarov

Oleg Komarov (view profile)

on 11 Apr 2011

You have to add the path

Paulo Silva

Paulo Silva (view profile)

Answer by n

n (view profile)

on 28 May 2012

Hi,

Please consider that you should be EXACTLY in the same directory; and not even in sub-directories within the right path.

I hope this solves the case. It worked for me.

0 Comments

n

n (view profile)

Answer by Keith Kripp

Keith Kripp (view profile)

on 10 Jun 2013

I've encountered this error when attempting to call MEX functions that were built/compiled on machines running a different version of Windows.

e.g. I build a MEX file from source code on a 32 bit machine, transfer it somewhere down the road to a 64 bit machine, and then attempt to call the function.

Seems like this error often has little to do with the arg type being 'double.'

1 Comment

Matt J

Matt J (view profile)

on 10 Jun 2013

Seems like this error often has little to do with the arg type being 'double.'

Well, sometimes it genuinely is an issue of the arg type, as shown here

>> sin('a')
Undefined function 'sin' for input arguments of type 'char'.

Clear 'sin' does exist, but just doesn't know what to do with char input.

As for the MEX-file issue, that has nothing to do with the 64bit-ness of Windows, only the 64bitness of the MATLAB version. 64-bit MATLAB will be looking for files with extension 'mexw64' whereas a 32-bit compiled mex file will have extension 'mexw32'. So, that really is a case of MATLAB not being able to find a matching file.

Keith Kripp

Keith Kripp (view profile)

Answer by Devi Jorks

Devi Jorks (view profile)

on 18 Jul 2013

in case of the sin(a) just dont put the '', then it works fine, at least on winxp 32bit

0 Comments

Devi Jorks

Devi Jorks (view profile)

Answer by Majid

Majid (view profile)

on 12 Aug 2013

In my case, there was a function that is used in my code but it was not in the directory, so by changing the location of the sub function and copying in the active directory , the problem is solved now.

0 Comments

Majid

Majid (view profile)

Answer by Resorcap

Resorcap (view profile)

on 8 Nov 2014

Before run function, add current absolute path:

add(pwd);

And this worked for me.

0 Comments

Resorcap

Resorcap (view profile)

Answer by Eyasu getahun Chekole on 19 Apr 2015 at 11:44
Edited by Eyasu getahun Chekole on 19 Apr 2015 at 11:46

I am pretty sure that the reason why this problem happened is because of the license of the toolbox (package) in which this function belongs in. Write

which functionName 

and see what will be the result. If it returns path of the function and the comment

"Has no license available", 

then the problem is related to the license. That means, license of the package is not set correctly. Mostly it happens if the package (toolbox) of this function is added later, i.e., after installation of the original `matlab`. Please check and solve the license issue, then it will work fine.

0 Comments

Contact us