Directory path for .m files and .dll files
Show older comments
I have Matlab R2011a. When functions defined in files with extension .m and and .dll, .maxglx, mexglx, and .c files are all in one folder, I can not call the user defined functions in Matlab command line. As though these functions don't exist. However, >>help function_name CAN find the function. The error message is:
??? Undefined function or variable 'user defined function name'.
Summary: there is one filder with .dll, .m, .c, .mexglx files. I CAN NOT call the functions defined in .m. When I move the function to a different folder with no other .c or .mexglx files, then I can call the user defined functions.
R/ Bahman Darian
5 Comments
Walter Roberson
on 4 Feb 2013
Edited: Image Analyst
on 8 Feb 2013
Are the problem functions the ones in the .m files?
Or are you saying that if for any one function name if you isolate the .m (for help info) and .c and .mexglx for the function into a distinct directory without the .c and .mexglx that are for other functions, then it works then?
Or is the issue that it cannot find user-defined functions inside the .dll but can find them inside .mexglx ?
I am a bit confused about which operating system you are using, as .mexglx is for Linux but .dll is not for Linux.
Bahman
on 8 Feb 2013
Walter Roberson
on 8 Feb 2013
Edited: Walter Roberson
on 8 Feb 2013
Is there a sinc.dll file? If so then MATLAB might look in there for the executable code instead of looking in the .m file for the code. I am not positive about this on 64 bit MATLAB; if you are using 32 bit MATLAB then it should certainly look at the .dll . But does the .dll contain 32 bit or 64 bit code?
Bahman
on 8 Feb 2013
Jan
on 8 Feb 2013
How could you open the .dll files in Notepad, when there are no .dll files?
Is the error message really "??? Undefined function or variable 'user defined function name'." or is "user defined function name" a replacement for the forum? Please post a copy of the code you are using and of the error message. Explaining what you want to do and interpretations of the error message are not useful.
Answers (2)
Jan
on 4 Feb 2013
2 votes
The help command looks for the M-file in every case, while calling a function from another M-function prefers the compiled Mex function. This function is found, when the folder is either the current folder (see cd) or if it is included in the path (see addpath or pathtool).
The .c file and compiled files which do not belong to your operating system (e.g. DLL under Linux) are ignored.
1 Comment
Kaustubha Govind
on 4 Feb 2013
Also, if you're on 64-bit Linux with 64-bit MATLAB, you need to get the 64-bit MEX-files (which have an extension .mexa64), the ones with .mexglx extensions are for 32-bit Linux.
Bahman
on 8 Feb 2013
0 votes
2 Comments
So please ask the question agian as clear as possible. Which commands to you try to run, what does "which sinc -all" reply, which error message do you get? It does not matter if you have called MEX or if compiled files have been created by somebody else.
Did you check the integrity of the file system already? This is most likely not the problem, but a good practice in general.
Kaustubha Govind
on 8 Feb 2013
@Bahman: Your DLLs are probably 32-bit versions and won't work on 64-bit MATLAB. You can either recompile the MEX-files using the "mex" command in MATLAB for 64-bit Windows, or install 32-bit MATLAB on your 64-bit machine. (Note that the .dll extension was used for MEX-files in older versions of MATLAB. It is now recommended to recompile to produce the platform specific .mexw32 or .mex64 extensions.)
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!