replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Using MatLab 6.5 (and later versions) with FTN95
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 

Using MatLab 6.5 (and later versions) with FTN95

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> KBase
View previous topic :: View next topic  
Author Message
silverfrost
Site Admin


Joined: 29 Nov 2006
Posts: 191
Location: Manchester

PostPosted: Sat Jun 25, 2005 3:34 am    Post subject: Using MatLab 6.5 (and later versions) with FTN95 Reply with quote

MATLAB � The MathWorks Inc.
You can download the files mentioned in this item [url="http://www.silverfrost.com/public_downloads/MatLab.zip"]here[/url]:

This document describes how to use the Salford Fortran compiler FTN95 with MATLAB 6.5. For this purpose you will need the following Salford files:

SF95opts.bat and SF95opts.stp
(these go in C:MATLAB6p5binwin32mexopts)

matlab.ins
(this must go in C:Program FilesSalford SoftwareFTN95include)

use.dll
(this can go in the current working directory)

salflibc.dll and salflibc.lib
(you need a contemporary version of these standard Salford libraries)

Build.bat is an optional extra for building from a DOS box.

use.c is the code for use.dll. This was compiled using a Microsoft compiler.

timestwo.f is a sample Fortran program.

Configuring MATLAB to use FTN95
After you have put the above two files into the mexopts sub-directory, from the MATLAB command line type:

mex -setup

As directed, ask for a list of compilers and select FTN95.

As a test, change to the directory for the above sample timestwo.f and type:

mex timestwo.f

Now type:

use('timestwo')

Finally type something like:

y = timestwo(4)

The "use" command is a temporary work around that explicitly loads timestwo.dll. Otherwise when you first use timestwo you will get a floating point exception. After this failure a second attempt will work. Using the "use" command simply avoids the unsightly error message.

Changes required in the Fortran samples
timestwo.f illustrates the changes that need to be made to the standard MATLAB sample programs.

1. From MATLAB version 6.0 onwards you must define the 'Gateway' function mexFunction as F_STDCALL.
2. Include <matlab.ins> as the first line of mexFunction.
3. Instead of %val, use DCORE8 for DOUBLE PRECISION and CORE4 for INTEGER.
4. Functions like mxCopyPtrToReal8 are not needed because DCORE8 can be used instead (see timestwo.f).
5. For NULL use CORE4(0).

Note that DCORE8 and CORE4 etc. are interchangable. Different names are used to maintain consistent types.

------------
Administrator
Silverfrost Forums
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> KBase 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