Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Intergrating MATLAB?

Victor_W_
Beginner
820 Views

Hi all,

I went through pages and pages of MATLAB and Fortran linking instructions,on MEX, MATLAB engine etc, I cant get a good grasp on a clear instruction to do so?

I use Intel Visual Fortran to program my code, modified on Microsoft Visual Studio, and to execute my program I open 'Fortran Build Environment for applications running on Intel(R) 64' through command: ifort fortrancodename.for

Now my question I would like to use some inbuilt functions on MATLAB (EXAMPLE [A,B]=eig(b)) - and reinterpret the solution back into fortran. Wishfully something like:

...

(Fortran Code with variable A B C D)

...

CALL-INSERT-COMMAND-INTO-MATLAB-ENGINE (eig([A B;C D])

...

(Fortran Code with variable A B C D and ANS)

...

Impossible? Possible?

Thanks

0 Kudos
1 Reply
mecej4
Honored Contributor III
820 Views

It is possible but, given the complexities of interoperating between a compiled language and an interpreted language, not to mention the difficulties associated with debugging, can you really justify this approach? For the example that you cited, after you call Matlab from Fortran Matlab may very well call a function (one that performs "eig") in an MKL DLL to calculate the eigenvalues.

It is much easier to call that function directly from your Fortran code. On the other hand, building a DLL from Fortran code for a function that can be called from Matlab is a more straightforward thing to do, and can greatly speed up Matlab routines that make numerous calls to evaluate the function.

0 Kudos
Reply