Dynare fname.mod

Hi all, I have a very simple question about using dynare fname.mod. For example, I have several mod files named as “rbc.mod, NK.mod,sw.mod,…”. I define fname=‘rbc’ for example. And then I want to run dynare fname.mod. I get errors. Is there any way to do this?
My idea is just changing fname at begging. I can then make use of fname_dynamic.m and also fname_results.mat in later programmes.
Thanks in advance.

Could you please explain what you are trying to do? Usually, you call rbc.mod with

Thanks for your reply. I don’t want to run dynare rbc.mod directly. My codes is

dynare fname.mod.

I have a function, where fname is inpute, I’ll make use the dynare results as output (i.e.oo_,M_).

In that case, you should use the eval command of Matlab:

It works. Thank you very much.