Thread Subject: how i create the mex file of this subroutine

Subject: how i create the mex file of this subroutine

From: abdelmoumen

Date: 11 Nov, 2009 13:51:04

Message: 1 of 7

hello everybody;

i have this fortran subroutine: http://ab-82.ifrance.com/FFLD.f

i want create the mex file but there are many "COMMON" blocs that i dont know with what i replace them

thank's

Subject: how i create the mex file of this subroutine

From: James Tursa

Date: 11 Nov, 2009 14:46:02

Message: 2 of 7

"abdelmoumen " <bmoumen27@yahoo.fr> wrote in message <hdefg8$8fs$1@fred.mathworks.com>...
> hello everybody;
>
> i have this fortran subroutine: http://ab-82.ifrance.com/FFLD.f
>
> i want create the mex file but there are many "COMMON" blocs that i dont know with what i replace them
>
> thank's

You don't have to replace them at all. Just write a mexFunction wrapper that takes the inputs from MATLAB and then sets the appropriate arguments & common block variables, and then call the subroutine. Then copy the subroutine outputs into the mxArray variables you are returning to MATLAB.

James Tursa

Subject: how i create the mex file of this subroutine

From: abdelmoumen

Date: 11 Nov, 2009 15:26:03

Message: 3 of 7

"James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hdeina$1vt$1@fred.mathworks.com>...

> You don't have to replace them at all. Just write a mexFunction wrapper that takes the inputs from MATLAB and then sets the appropriate arguments & common block variables, and then call the subroutine. Then copy the subroutine outputs into the mxArray variables you are returning to MATLAB.
>
> James Tursa

hi James;
in this tutorial: http://hal.archives-ouvertes.fr/docs/00/06/99/95/PDF/RT-0176.pdf
they say that all COMMON blocks must be replaced

Subject: how i create the mex file of this subroutine

From: James Tursa

Date: 11 Nov, 2009 16:15:13

Message: 4 of 7

"abdelmoumen " <bmoumen27@yahoo.fr> wrote in message <hdel2b$2cg$1@fred.mathworks.com>...
> "James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hdeina$1vt$1@fred.mathworks.com>...
>
> > You don't have to replace them at all. Just write a mexFunction wrapper that takes the inputs from MATLAB and then sets the appropriate arguments & common block variables, and then call the subroutine. Then copy the subroutine outputs into the mxArray variables you are returning to MATLAB.
> >
> > James Tursa
>
> hi James;
> in this tutorial: http://hal.archives-ouvertes.fr/docs/00/06/99/95/PDF/RT-0176.pdf
> they say that all COMMON blocks must be replaced

This pdf file is incorrect. You do *not* have to replace COMMON blocks. They work just fine. It may be beneficial to replace them to make the code cleaner and easier to read & maintain, but there is no technical reason why they *must* be replaced.

James Tursa

Subject: how i create the mex file of this subroutine

From: abdelmoumen

Date: 12 Nov, 2009 15:21:03

Message: 5 of 7

"James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hdenuh$506$1@fred.mathworks.com>...
 
> This pdf file is incorrect. You do *not* have to replace COMMON blocks. They work just fine. It may be beneficial to replace them to make the code cleaner and easier to read & maintain, but there is no technical reason why they *must* be replaced.
>
> James Tursa

so i write the interface mex file and i compile it. then i use it like any library.??

Subject: how i create the mex file of this subroutine

From: James Tursa

Date: 12 Nov, 2009 16:12:02

Message: 6 of 7

"abdelmoumen " <bmoumen27@yahoo.fr> wrote in message <hdh94v$gt0$1@fred.mathworks.com>...
> "James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hdenuh$506$1@fred.mathworks.com>...
>
> > This pdf file is incorrect. You do *not* have to replace COMMON blocks. They work just fine. It may be beneficial to replace them to make the code cleaner and easier to read & maintain, but there is no technical reason why they *must* be replaced.
> >
> > James Tursa
>
> so i write the interface mex file and i compile it. then i use it like any library.??

No. If you write a mex interface for the routine and compile it, then it would be used just like a regular MATLAB function or m-file, not a library. If you want a dll library that you can use with loadlibrary etc., then you don't write a mex interface for it, you just compile it as a library.

James Tursa

Subject: how i create the mex file of this subroutine

From: abdelmoumen

Date: 14 Nov, 2009 10:57:03

Message: 7 of 7

"James Tursa" <aclassyguy_with_a_k_not_a_c@hotmail.com> wrote in message <hdhc4i$s53$1@fred.mathworks.com>...
> No. If you write a mex interface for the routine and compile it, then it would be used just like a regular MATLAB function or m-file, not a library. If you want a dll library that you can use with loadlibrary etc., then you don't write a mex interface for it, you just compile it as a library.
>
> James Tursa

please a link or doc for this. thank's

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com