Multisector model: too many variables for matlab

Dear all,

I’m currently running a multisector Calvo model. The pre-processing works perfectly but once I run the generated m-files I run into issues with Matlab. Specifically, I get the following error message:

Error using assignin
The current workspace already has too many variables; there is no room for “w_186_50”,

where w_186_50 is a parameter. I initialize the parameters using the following code:

@#for i in sectors
parameters

@#for j in sectors
    w_@{i}_@{j}
@#endfor

@#endfor

where sector is 350. I assign values according to

@#for i in 1:num
@#for j in 1:num
set_param_value(‘w_@{i}_@{j}’,weights_sector(@{(i-1)*num+j}));
@#endfor
@#endfor

where weights_sector is a 1 x (350 times 350) vector.

Is there a way to to just define a paramter vector W and then access different entries in the model section?

I also thought of way to manipulating the ex-post generated m files.

Any (alternative) suggestions are highly appreciated.

Many thanks in advance!
Michael

Unfortunately, that is currently not possible. You are running into the limit of stackoverflow.com/questions/20328159/matlab-variable-count-limit

Hi Johannes,

thank you so much for your reply!

Is there a way to directly modify the m files generated by dynare?
The pre-processing works perfectly and all the m files are generated so I thought I could possibly directly manipulate the m files.
Unfortunately, I do not really have any experience with that but thought that it should in principle be possible.

I’m looking forward to your comments and thoughts!

Thanks,
Michael

You would need to manipulate the main m-file, i.e. the one with the same name as the mod-file. There, you can delete the lines writing the parameters to the workspace, but given the size of your model, this should be infeasible to do manually. See github.com/DynareTeam/dynare/issues/946