Re: matlab mex file (fortran)



markuj wrote:
> This is my mexopts.bat file. Is it correct?
> I send you my hypothetical fortran code too.

* snip mexopts.bat *
> -----------------------------------------------------------
> !
> ! Program Celsius Table: Prints simple Fahrenheit-Celsius table
> !
> program celsius_table
> implicit none
> real Fahrenheit, Celsius
>
> print *,' Fahrenheit Celsius'
> print *,'--------------------------'
> do Fahrenheit = 30, 220, 10
> Celsius = (5.0/9.0) * (Fahrenheit-32.0)
> print '(F13.0,F12.3)',Fahrenheit,Celsius
> end do
> end
> -----------------------------------------------------------
> mark wrote:
>
>>
>>It looks like your compiler is now setup right. Could you post
>>your
>>fortran code? It should follow this basic format.
>>
>>Subroutine mexFunction(nlhs, plhs, nrhs, prhs)
>>
>>integer nlhs, nrhs
>>integer plhs(*), prhs(*)
>>C Body
>>return
>>end


Did you even read mark's post? You should also consult the mathworks
External Interfaces Documentation. As mark pointed out, you need the
SUBROUTINE MEXFUNCTION
END SUBROUTINE

Also, I don't think you'll be able to use print from your mex functions.
You'll need to use mexPrintf
.



Relevant Pages

  • Re: Recompilation of mex-files fails
    ... I used 'function' as the fortran code to be called is a ... changing 'function' to 'subroutine' avoids this warning. ... C The gateway routine ... subroutine mexFunction(nlhs, plhs, nrhs, prhs) ...
    (comp.soft-sys.matlab)
  • Re: Fortran Compling problem
    ... >> I got a Fortran code called APEX1310.f and two codes called ... or write your own GETDAT and GETTIM wrapper functions. ... subroutine GetDat ...
    (comp.lang.fortran)
  • Re: computing Bernoulli numbers
    ... Fortran code for evaluating a sequence of Bernoulli numbers and other special functions: ... -| subroutine bernoulli_series ... -|whether an extra term should be added or not is ...
    (comp.lang.fortran)
  • Calling a fortran subroutine from Visual C++
    ... the fortran code as a subroutine. ... The specifications for this project have ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vc)

Loading