ERROR: Can't open file model.m for writing


Hello everybody,

I am experiencing problems with my mod file and I was wondering if you could help. I believe that some people had similar issues in the past, but the solutions don’t seem to apply to my case. I recently had some difficulties saving my Matlab files because of windows defender, so I excluded Dynare from the analysis of the antivirus just in case but the problem still persists. I get the following error when I run my file.

dynare ‘model.mod’

Configuring Dynare …
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Local state space iteration (second order).
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.
[mex] Quasi Monte-Carlo sequence (Sobol).
[mex] Markov Switching SBVAR.

Using 64-bit preprocessor
Starting Dynare (version 4.5.7).
Starting preprocessing of the model file …
Found 22 equation(s).
Evaluating expressions…done
Computing static model derivatives:

  • order 1
    Computing dynamic model derivatives:
  • order 1
    ERROR: Can’t open file model.m for writing

Error using dynare (line 229)
DYNARE: preprocessing failed

Thank you for your help.

Skander.model.mod (5.2 KB)


Have you tried using a different folder and a different name?


Yes, I did try multiple times but it still doesn’t work. I have asked one of my freinds to run it on their computer and it seemed to work for on his computer.