Problem: In an assignment A(I) = B


When I run my model on dynare I keep getting the following message:

In an assignment A(I) = B, the number of elements in B and
I must be the same.

Does this mean that I have lagged one of the variables incorrectly (the usual use stock at the end of the period and not beginning of the period), or could there be another explanation?

If it is a timing of lags issue, I suspect it’s probably something to do with me including a lagrangian multipler in the model.

My dynare model includes a lagrangian multiplier on an employment evolution equation a la mortensen pissarides:

n(+1) = (1-p)n + q*v

I realize that n here should be modelled as one would model capital (i.e. stock at the end of the period and hence n above should be n(-1) etc), but what about the lagrangian multiplier on this equation? How would one write the timing for this lagrangian multiplier? Should it also be treated in a similar manner? Unfortunately I can’t get rid of this lagrangean multiplier so I have to include it in the model. Any help on this matter would be greatly appreicated.


the error you’re getting is from matlab, not dynare. you’re trying to assign an array of one dimension to be equal to an array of a different dimension (eg, trying to set a scalar equal to a matrix).

without more details of your model it’s hard to say more than this, but I hope it helps.


Most often, it happens when one has forgotten to give a value to a parameter

To debug this kind of problem, you can use Matlab debugger with
dbstop if error

it will stop at the line of the *.m file with the error, you can then examine all the variables involved on that line

To get out of debug mode, type


to cancel the debug trap:

dbclear all

Kind regards


Thanks a lot guys. The debug mode worked magic. I should check more closely for small problems in the model before starting hypothesizing about grandiose ones!

Thanks once again.