MATLAB Answers


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

Asked by D
on 10 Apr 2011
Latest activity Commented on by Jennifer Wu
on 25 Nov 2015 at 21:52

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.



No products are associated with this question.

8 Answers

Answer by Walter Roberson
on 11 Apr 2011

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


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.

on 13 Mar 2014

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

Answer by Eyasu getahun Chekole on 19 Apr 2015
Edited by Eyasu getahun Chekole on 19 Apr 2015

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.

  1 Comment

Jennifer Wu
on 25 Nov 2015 at 21:52

This is the root cause for my case.

Answer by Paulo Silva
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


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
on 11 Apr 2011

You have to add the path

Answer by n
on 28 May 2012


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.


Answer by Keith Kripp
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
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.

Answer by Devi Jorks
on 18 Jul 2013

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


Answer by Majid
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.


Answer by Resorcap
on 8 Nov 2014

Before run function, add current absolute path:


And this worked for me.


Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!