I have some matlab codes (.m file) and its corresponding MATLAB MEX (.mexw32) file in a folder. I am new to the matlab of using mex files. I am not able to run the m files now.
Any help is appreciated.
Thanks

4 Kommentare

James Tursa
James Tursa am 10 Jan. 2016
Please show exactly what files you have, and exactly what commands you ran, and post the exact error messages you are getting. Are you running Windows 32-bit MATLAB?
Jab
Jab am 10 Jan. 2016
I have the attached files in a folder. I am getting the following error Attempt to execute SCRIPT curvelet3d_transform as a function: C:\Users\Emimal Jabason\Documents\MATLAB\curveleg t3d_transform.m
And, I am running WIndows 64-bit Matlab.
Thanks fr your help James!
veerendhra kumar challa
veerendhra kumar challa am 3 Okt. 2017
i have the attached file in folder.i am getting the following error attempt to execute Error using mex C:\Users\VIGNAN\Downloads\__MACOSX\classify\private\meanShift1.c not found; check that you are in the correct current folder, and check the spelling of 'C:\Users\VIGNAN\Downloads\__MACOSX\classify\private\meanShift1.c'.
Error in toolboxCompile (line 21) mex([dir 'meanShift1.c'], '-outdir', dir );
i am running Windows 64-bit Matlab.
Walter Roberson
Walter Roberson am 3 Okt. 2017
Bearbeitet: Walter Roberson am 3 Okt. 2017
Why are you trying to compile a MACOSX version on MS Windows ?
I am not sure which files you are referring to as "attached file" ?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

ram vanguri
ram vanguri am 10 Jan. 2016

0 Stimmen

You need to compile the c file into a mex library (in matlab).
Setup your Matlab's mex compiler:
>> mex -setup then run the .m file

7 Kommentare

After you mex -setup you probably need to
mex FileName
where FileName is the name of the file without extension. For example if you had ghoatbleet.c and ghoatbleet.m then you would invoke
mex ghoatbleet
and if all goes well you would then be able to call ghoatbleet as if it was function written in .m
result = ghoatbleet(....)
Jab
Jab am 10 Jan. 2016
Bearbeitet: Walter Roberson am 11 Jan. 2016
I am getting the following error after trying the above steps.
But My files are in the folder.
E:\2nd WORK\curvelet3d_transform not found; check that you are in the correct current
folder, and check the spelling of 'E:\2nd WORK\curvelet3d_transform'.
Walter Roberson
Walter Roberson am 11 Jan. 2016
You need the C or C++ source, curvelet3d_transform.c or curvelet3d_transform.cpp or curvelet3d_transform.C .
With what you have, you are restricted to using the software with a 32 bit MATLAB on MS Windows.
The routine appears to potentially be part of "Sparsebox", as a routine of that name is mentioned in the thesis http://irfu.cea.fr/Phocea/file.php?class=std&&file=Doc/Publications/Archives/irfu-10-14-T.pdf . However, I do not seem to find any code by that name. You might be able to track down the author and ask about it.
Jab
Jab am 12 Jan. 2016
Thank you very much! If I use CurveLab-2.1.3 software, Could you please help me how to add this in Matlab 2015? How to get started this s/w in Matlab? It contains all cpp and mex files but everything different folders.
James Tursa
James Tursa am 3 Okt. 2017
Bearbeitet: James Tursa am 3 Okt. 2017
Correcting an old post.
Walter's comment above is incorrect. When mexing a source file, you need to use the file name including the extension. So if you had ghoatbleet.c then you would issue the following at the command line:
mex ghoatbleet.c
If you issue the command without the .c extension, MATLAB will search for the file name without the extension, not find it, and report a file not found error.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by