Prev: QAM matlab code
Next: Interfacing Matlab in C-Code
From: Kevin Ostheimer on 20 Sep 2006 04:02 thank you all. I?ve done it now with the Borland 5.5 Freecompiler. The code is compiled to a .MEXW32 file. I used the Borland Compiler via a "mex" call under Matlab. So bin ich in der Lage meine C-Routinen zu kompilieren und in Matlab auszuf?hren. Der Borland Compiler gibt mir hier immer Feedback wenns mal falsch l?uft. Allerdings sollte ich mehr ?ber den Umgang mit MEX-Files und deren Ausf?hrbarkeit und Schnittstellen in Matlab wissen. Zur Zeit kompiliere ich zwar erfolgreich, jedoch bekomme ich beim Aufruf der *.mexw32 Datei folgende Fehlermeldung: ********************************************************* Mex file entry point is missing. Please check the (case-sensitive) spelling of mexFunction (for C MEX-files), or the (case-insensitive) spelling of MEXFUNCTION (for FORTRAN MEX-files). ??? Invalid MEX-file 'H:\Diplomarbeit\source\kevcomp.mexw32': Das angegebene Modul wurde nicht gefunden. *********************************************************
From: Michael Wild on 20 Sep 2006 04:46 On Wed, 20 Sep 2006 04:02:05 -0400, Kevin Ostheimer wrote: > thank you all. > > I?ve done it now with the Borland 5.5 Freecompiler. The code is > compiled to a .MEXW32 file. I used the Borland Compiler via a "mex" > call under Matlab. > > So bin ich in der Lage meine C-Routinen zu kompilieren und in Matlab > auszuf?hren. Der Borland Compiler gibt mir hier immer Feedback wenns > mal falsch l?uft. > > Allerdings sollte ich mehr ?ber den Umgang mit MEX-Files und deren > Ausf?hrbarkeit und Schnittstellen in Matlab wissen. Zur Zeit > kompiliere ich zwar erfolgreich, jedoch bekomme ich beim Aufruf der > *.mexw32 Datei folgende Fehlermeldung: > ********************************************************* > Mex file entry point is missing. Please check the (case-sensitive) > spelling of mexFunction (for C MEX-files), or the (case-insensitive) > spelling of MEXFUNCTION (for FORTRAN MEX-files). > ??? Invalid MEX-file 'H:\Diplomarbeit\source\kevcomp.mexw32': Das > angegebene Modul wurde nicht gefunden. > ********************************************************* please, stick to english on this newsgroup, not all of us understand german... now: what do you really want? is it a mex file? is it a mex file calling the matlab engine? or ist it a stand-allone application calling the matlab engine? the code you showed is not a mex file and must not be compiled as such. for that you would need to implement the mexFunction, but as you have a main function i assume it's going to be a standalone app. what is a mex function? it is a piece of c or fortran code which is compiled into a shared library (dll on windows, forget about the suffix) and is dynamically loaded by matlab. it then feels exactly the same as a normal m-coded function. the thing you wanted to do (at least what your original code shows) is a standalone program which at some point wants to evaluate some matlab code. for this it opens a connection to the matlab engine, passes it some code, if necessary retrieves some results, and closes the engine again. what is confusing me, is the fact that you try to compile your standalone program as a mex function, hence the question. michael
From: blechstange on 20 Sep 2006 06:08
Michael Wild wrote: > > > On Wed, 20 Sep 2006 04:02:05 -0400, Kevin Ostheimer wrote: > >> thank you all. >> >> I?ve done it now with the Borland 5.5 Freecompiler. The code is >> compiled to a .MEXW32 file. I used the Borland Compiler via a > "mex" >> call under Matlab. >> >> So bin ich in der Lage meine C-Routinen zu kompilieren und in > Matlab >> auszuf?hren. Der Borland Compiler gibt mir hier immer Feedback > wenns >> mal falsch l?uft. >> >> Allerdings sollte ich mehr ?ber den Umgang mit MEX-Files und > deren >> Ausf?hrbarkeit und Schnittstellen in Matlab wissen. Zur Zeit >> kompiliere ich zwar erfolgreich, jedoch bekomme ich beim Aufruf > der >> *.mexw32 Datei folgende Fehlermeldung: >> ********************************************************* >> Mex file entry point is missing. Please check the > (case-sensitive) >> spelling of mexFunction (for C MEX-files), or the > (case-insensitive) >> spelling of MEXFUNCTION (for FORTRAN MEX-files). >> ??? Invalid MEX-file 'H:\Diplomarbeit\source\kevcomp.mexw32': Das >> angegebene Modul wurde nicht gefunden. >> ********************************************************* > > > please, stick to english on this newsgroup, not all of us > understand > german... > > > now: what do you really want? is it a mex file? is it a mex file > calling > the matlab engine? or ist it a stand-allone application calling the > matlab > engine? the code you showed is not a mex file and must not be > compiled as > such. for that you would need to implement the mexFunction, but as > you > have a main function i assume it's going to be a standalone app. > > what is a mex function? it is a piece of c or fortran code which is > compiled into a shared library (dll on windows, forget about the > suffix) > and is dynamically loaded by matlab. it then feels exactly the same > as a > normal m-coded function. > > the thing you wanted to do (at least what your original code shows) > is a > standalone program which at some point wants to evaluate some > matlab code. > for this it opens a connection to the matlab engine, passes it some > code, > if necessary retrieves some results, and closes the engine again. > > what is confusing me, is the fact that you try to compile your > standalone > program as a mex function, hence the question. > > > > michael > Moin, soweit ich weiss, musst du bei der Erzeugung eines Programms mit dem mex compiler die mexopts-datei explizit angeben. Fuer deinen Compiler dann wohl bcc55engmatopts.bat. Du musst also sowas eingeben wie mex -f C:\Programme\Matlab\R2006b\bin\win32\mexopts\bcc55engmatopts.bat C:\Programme\Matlab\R2006b\extern\examples\eng_mat\engdemo.c Die Datei engdemo.c ist ?brigens ein Beispiel wie man die matlab eingine ?ber das mex interface starten kann. musste nur deine pfade anpassen. For the engish users: i've told him to explicitly use the -f option when compiling a mex program. greetz |