Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



FORTRAN mex files
Posted:
Jun 20, 1996 6:21 AM


Can anyone help me with the following problem? Please be patient as I have to carefully explain what I am trying to do.
DETAILS: MATLAB version 4.2. UNIX operating system.
BACKGROUND: I have a FORTRAN subroutine which requires three arguments to read from a formatted ascii data file (data.dat). I've incorporated this subroutine into a standalone program which compiles without any problem. Upon execution, an array of numbers are produced.
I want to interface this FORTRAN subroutine with MATLAB. I've amended and renamed the gateway program yprimeg.f (provided as an example) in the following way: 1. commented out matrix creation for a return argument 2. commented out the statement which copies the output stored in the local array to matrix output.
At the matlab prompt, typing,
!fmex file.f fileg.f
produces
/usr/.../fmex[310]: 0: not found.  file.f: file: other subroutines: fileg.f: mexfunction:
(I get "/usr/.../fmex[310]: 0: not found." when I use yprime.f and yprimeg.f. MATLAB accepts yprime(t,y) without any problems).
Yet, when I type file(a,b,c), MATLAB returns
*** FORTRAN I/O ERROR 933: END (OR BEGIN) OF FILE WITH NO "END=" SPECIFIER FILE: /users/.../data.dat, UNIT: 1 ( 0) 0xc11a166c io_ded + 0x37c [/usr/lib/.../libcl.sl] etc
Now I've included an "END=" specifier in the READ statement of the subroutine, and the same error message is returned when I follow the above procedure.
QUESTION: The question is: if the standalone FORTRAN program compiles and runs without any problems, and !fmex file.f fileg.f looks OK, then why does the program fall over when I pass down the same arguments that I use in the standalone FORTRAN program?
If this makes any sense and you can help, please email to the address below:
wayneb@astro.warwick.ac.uk
Thanks in advance,
W. Brown



