Linking DYNARE and Fortran

Dear All,

I hope that somebody out there could help me.

I am running some optimization code, written in Fortran. For that code I need
results from DYNARE. Basically, the structure should look something like:

Fortran sends x to DYNARE
DYNARE returns some data y to Fortran
Fortran uses y, computes new x, sends it to DYNARE…

I’ve read the chapters from MATLAB regarding the links between MATLAB and
Fortran, but somehow that does not work for me. It works for simple examples
presented in the manual, but when I change the function and input something
that calls DYNARE code, nothing happens. I believe that I have defined and
included all the paths, but obviously something is missing. For example,
assume that I use forward.m file, produced by running

DYNARE forward.mod

If I type


in the command line everything is fine, and I get the desired results.
However, when I include this function into the engine subroutine, that links
MATLAB and Fortran, nothing happens. It’s not even complaining that it
couldn’t find certain files, just runs, producing no results.

Anyone had any experience with linking MATLAB, or even better, DYNARE and
Fortran? Help is very much needed and would be very appreciated.



Stanislav Zakovic
Research Fellow
Department of Computing
Imperial College
London SW7 2AZ

Dear Stanislav,

I don’t think that calling Dynare from Fortran is the thing to do. First of all, you don’t want to redo the parsing of the *.mod file at each call from the Fortran call.

You need to call from Fortran the Matlab functions from the Dynare toolbox that computes the results that you want. You may even call the Fortran program from inside the Dynare *.mod file.

What exactly do you want to do?

Kind regards