Calling ramsey_model in a loop

Dear Prof. Pfeifer,

I have a question on how to call the ramsey_model in a loop, so that each time the steady-state is re-computed for a new given value of the policy instrument.
In this regard, note that the SS for my model is provided within the steady_state_model block, in analytical terms as a function of the policy instrument (ie. taul).

The code I have written for this purpose looks like this:

for i=1:10

taulss=taul_grid(i);

if i==1
dynare MyRamsey.mod noclearall;
else
oo_.steady_state=nan(22);
oo_.steady_state(11)=taulss;
steady;
perfect_foresight_setup;
perfect_foresight_solver;
resid;
end

if oo_.deterministic_simulation.status ~= 1
error(‘Deterministic simulations failed.’)
end

end

I was hoping that, by providing the new guess for the instrument (oo_.steady_state(11)=taulss),
and calling the command ¨steady¨ , I would have forced dynare to re-compute the ramsey steady state, before running the deterministic simulation. However this doesn´t seem to work.
In fact, while dynare is re-computing the ramsey steady state at each iteration, the value of the instrument (and, therefore, the whole steady state) is not updated.

Can you please advice on where I got it wrong?

Many thanks!
Mattia

I would need to see the full codes.