Error in "union(var_obs_index'" in Dynare 4.2.2


I receive the following error when running under Dynare 4.2.2 the programme in annex which functioned perfectly well under Dynare 4.0.4:

??? Error using ==> union
Too many input arguments.

Error in ==> dynare_estimation_init at 213
k2 = union(var_obs_index’,[dr.nstatic+1:dr.nstatic+dr.npred]’, ‘rows’);

Error in ==> dynare_estimation_1 at 37
[data,rawdata,xparam1] = dynare_estimation_init(var_list_);

Error in ==> dynare_estimation at 62

Error in ==> test422a at 161

Error in ==> dynare at 120
evalin(‘base’,fname) ;

Undoubtedly there has been some change in Dynare 4.2.2 which causes this, but I do not know what to do about it. Could you help, please?
Thanks and regards
pirsy_m.m (2.09 KB)
test422a.mod (2.75 KB)

Hi, Are you sure you are really using Dynare 4.2.2 ? You can check by typping dynare_version at matlab’s prompt. I am not able to reproduce your problem using this version.

Best, Stéphane.

Thanks for your reply, Stephane, and sorry for the late response.

Both “which dynare” and “dynare_version” return the answer that I am indeed using Dynare 4.2.2, yet the error persists on my machine. I am using Matlab 7.8.0 (R2009a); could that be the source of the problem?


Could you check, which version of union you are using. According to
the syntax should be fine unless another function with the same name is higher in the Matlab path. Hence, try using “which union”.

Thank you for that suggestion.

The result of using “which union” is peculiar: despite my using Dynare 4.4.2, Matlab communicates that I am using

I definitely have

at the top of my “Set Path” list, so it seems odd that “union” would come from dynare_v3.

I suppose that I should suppress the old dynare_v3 from my main Dynare directory to resolve this?

Again, many thanks for your help.


You should remove dynare 3 from your path (to use the matlab/octave implementation). This can be done by issuing the following command in matlab:

rmpath D:\Quant\Dynare\dynare_v3\matlab

I don’t remember if this command has permanent effect. You can also open the matlab’s set path dialog box and remove this version of Dynare.

Best, Stéphane.

Thank you. I have removed dynare_v3 from the path and the model works correctly now. I greatly appreciate your advice - never would I have solved the problem otherwise!