Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

matOpen: how to use mat.h in fortran ?

102 views
Skip to first unread message

Max

unread,
Sep 23, 2009, 8:12:49 AM9/23/09
to
Hi,
I'm trying to include the C-file 'mat.h' into my Fortran code in order to generate mat-files with Fortran via the matOpen command. According to the Matlab-help this should be possible: http://www.mathworks.com/access/helpdesk_r13/help/techdoc/apiref/matopen_01.html#1081657
But when i try to include mat.h i get catastrophic errors from my compiler (Intel Fortran with Visual Studio 2008)...
Has anyone used mat.h with Fortran or has any experience in compiling C and Fortran mixed code?
Best regards,
Eli

James Tursa

unread,
Sep 23, 2009, 11:55:20 PM9/23/09
to
"Max " <el_...@gmx.de> wrote in message <h9d3c0$46k$1...@fred.mathworks.com>...

Never include any C headers. Just do this:

#include "fintrf.h"

That has everything you need for mex or eng stuff in it for Fortran. I have no idea why TMW doesn't include this necessary piece of information in their Fortran API doc.

James Tursa

Max

unread,
Sep 24, 2009, 7:40:22 AM9/24/09
to
Hi, thank you for your quick response...unfortunately i get
warning #5117: Bad # preprocessor line
when i try to compile the file - somehow the compiler is not able to put the stuff together. Maybe it is about to give the compiler/linker/whatever some instructions how to handle the .c file...

Max

unread,
Sep 24, 2009, 9:37:01 AM9/24/09
to
Hi again,
thank you for your answers... using #include "fintrf.h" in Fortran instead of the mat.h plus a lot of changes in the Visual Studio compiler settings finally solved it :-)
Unfortunately the Matlab documentation is not very helpful in that topic.

yigal...@gmail.com

unread,
Sep 2, 2013, 2:59:16 AM9/2/13
to
Hello,
could you please explain what changes in Visual Studio's settings are needed?
0 new messages