Dynare running .mod file

Hello,

I have a problem with the following code.
eval(fname);

Error using eval. Unrecognised function or variable ‘model’.

where fname is .mod file. I am using Dynare 4.5.6. It is not working. Does anyone know how to resolve this issue.

Always provide the full error message. Also never call your mod-fiel model.mod. Why don’t you use Dynare 5?

Thank you for your quick response!

I changed the name to ‘energy.mod’. fname=M_.fname here.
Here the error message:

eval(fname)
Error using eval
Unrecognized function or variable ‘energy’.

When I tried the following, I have no error, but there is no evaluation of function.
eval(‘fname’)

fname =

'energy'

When I use more updated version of Dynare. I have another problem: the dynare generates .dynamic.m (or .results.mat) files instead of _dynare.m (or _results.mat). I could not make dynare to read these files later because Matlab does not recognise ‘dot’ names (Matlab thinks ‘dot’ is operation).

Yes, the more recent Dynare version uses a class definition. But I still don’t understand how you are trying to invoke Dynare to get such an error message.

Can I use dynare energy.mod noclearall instead of eval(fname)?

Where do you use eval? It’s

dynare energy

I fixed the issue with eval. It seems like in new version of Dynare, I do not need to type eval.
It is working now.
I have encountered another problem:

Total computing time : 0h00m00s
Note: warning(s) encountered in MATLAB/Octave code

To be honest, I am not sure why I get this error message.

You were never supposed to use eval.