Beg for help: Levin's code for Ramsey policy

When running Levin’s code with his example “Bestsw.mod”, I use Dynare v3 and Matlab 2010b.

I type in command Window


It gives the following error:

??? Undefined function or method ‘struct2cell’ for input arguments of type ‘sym’.

Error in ==> get_ramsey at 119
lmss_coefdefs{icoefdef} = ‘lmss_vec(’,num2str(iev),’) = ‘,char(struct2cell(tmpval)),’;’];

I don’t know how to fix it. I’m begging for your help! (22.5 KB)
Bestsw.mod (11.4 KB)

I ran into exactly the same problem today. The reason that you get the error message is due to the function struct2cell, which is not included in my (and your) version of matlab.
Luckily you don’t need it to run get_ramsey. The way I fixed it is as follows: remove the command “struct2cell” at each line it appears in the get_ramsey.m file, this should work for you as well.
Pelin Ilbas

1 Like