forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Matlab engine form a Fortran program

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Mon Aug 10, 2009 12:09 pm    Post subject: Matlab engine form a Fortran program Reply with quote

Hi FTN95 Users,

I am trying to use the Matlab enige from a Fortran program. According to the supplied example in the Matlab-Help I need to include <fintrf.h>. This file has the following content (only part of it):

Code:

#if defined(WITH_COMMENTS)
/*
 * fintrf.h   - MATLAB/FORTRAN interface header file. This file
 *        contains the declaration of the pointer type needed
 *        by the MATLAB/FORTRAN interface.
 *
 * Copyright 1984-2006 The MathWorks, Inc.
 * All Rights Reserved.
 */
#endif
#if defined(__x86_64__) || defined(_M_AMD64) || defined(__amd64) ||     defined(__sparcv9)  || defined(__ppc64__)
# define mwpointer integer*8
# define mwPointer integer*8
# define MWPOINTER INTEGER*8
#else
# define mwpointer integer*4
# define mwPointer integer*4
# define MWPOINTER INTEGER*4
#endif
...


FTN95 is (unfortunatley) not supported by Matlab and the # might not be allowed. What is the neccesary changes which I need to make to be able to complie this include?

Johannes
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Mon Aug 10, 2009 6:39 pm    Post subject: Reply with quote

Hi everyone,

this seems to be a known problem. I found the same comments in the Mathworks forum:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/135815
http://www.mathworks.in/matlabcentral/newsreader/view_thread/164128

It seems like with each new version of Matlab the "logic" changes a bit. I would be glad if someone in the Silverfrost Forum could answer the following:

    does the linker/compiler have a switch like -cpp to compile Fortran and C;
    does anyone have some working example of calling the Matlab engine with FTN95?


Any advice in this context will be most welcome!

Johannes
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Tue Aug 11, 2009 8:12 am    Post subject: Reply with quote

Fortran code can be compiled with FTN95.
C/C++ code can be compiled with SCC.
SLINK can be used to link object files produced by either FTN95 or SCC or SRC (i.e. you could have a mixture of files in one linking process).

The only examples I know about are in the download that is given in the KBase article on Matlab in this forum.
Back to top
View user's profile Send private message AIM Address
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: Nürnberg, Germany

PostPosted: Tue Aug 11, 2009 8:25 am    Post subject: Reply with quote

Hi Paul,

thanks. The example in the KBase forum explains how to use a Fortran program as a m-file in the Matlab environment.

In the present topic the aim is to use Matlab functions from a Fortran program, i.e. the other way arround. I have worked through the example provided in the Matlab documentation without success.

Even though I assume that the solution must be quit simple, the Mathworks hotline only argue that FTN95 is not supported.

Anyway, thanks for your reply.

Johannes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group