File Exchange

image thumbnail

Call .m from Fortran

version 1.0 (9.88 KB) by

This program serves as a simple example on how to interface a Fortran program to MATLAB.

3.33333
4 Ratings

0 Downloads

Updated

No License

This heavily commented Fortran program serves as a simple example on how a MATLAB .m file can be called from Fortran. Suitable if this is your first time trying this.

The basic mechanism is to pack the C-compiled .m into a .dll and link to it from Fortran. Argument and result xfer mechanism is explained so that program can be easily expanded.

Comments and Ratings (9)

Matt

Matt (view profile)

8"unresolved external symbol" errors dispite of the adding .lib files

med salah abdelouahab

merci

dfa asdfa

J. Miguel Marin

I have downloaded the program to call a matlab dll from Fortran CVF 6.6B.
As it did not work with MatLab v 7.2 and I saw a message from Frank Tap, I would be very grateful if anyone might tell me how to deal with this issue.
Thank you very much

Frank Tap

After some minor modifications it worked fine for R2006a and CVF 6.6b. Previously I tried to do it myself and stopped because it took me too much time to find it out.

Alex Pudmenzky

Have you tried "looking into" libmx.lib with the DOS command "dumpbin/exports libmx.lib" (you can also use the "Windows Dependency Walker" available from http://www.dependencywalker.com/)? See comments in my code. You should see all those routines supplied by MATLAB with those two tools. If they are there I don't understand why they are not linked in, if they are not there you should find a library with them in your MATLAB installation.

C W

Did as you said. "unresolved external symbol" errors are reduced to 5 from 8 errors. It recognize the mxCopyPtrToReal8 and a few others, but error still occurs for mxGetData,mxGetNumberOfElements,mxCreateNumericMatrix,mxClassIDFromClassName,and mxDestroyArray. Any insight?

Alex Pudmenzky

Copy libmx.lib from your \extern\lib\win32\digital\df60\ Matlab area to "source" in your VF development area and then include libmx.lib into your project via: Project->addToProject->Files->select ".lib" from pulldown menu->select libmx.lib from "source". Same procedure for all other .lib's you may need.

C W

I keep having "unresolved external symbol" errors regarding to the mx* functions. I don't know how to solve this problem. I'm using the Windows 2000 and Visual Fortran 6.6.

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today