Problems with moments_varendo

After fixing the file matlab/selec_posterior_draws.m, as instructed in a previous post in this forum, I still get an error after running moments_varendo (see below). Can anyone please help? Thanks,

In kernel_density_estimate at 78
In posterior_moments at 76
In covariance_mc_analysis at 81
In posterior_analysis>job at 57
In posterior_analysis at 32
In compute_moments_varendo at 64
In dynare_estimation_1 at 1081
In dynare_estimation at 62
In brasil_estimacao at 2295
In dynare at 132
??? Subscript indices must either be real positive integers or logicals.

Error in ==> kernel_density_estimate at 82
xi(indx+[1 2]) = xi(indx+[1 2]) + [1-temp,temp]’;

Error in ==> posterior_moments at 76
[density(:,1),density(:,2)] =
kernel_density_estimate(xx,number_of_grid_points,…

Error in ==> covariance_mc_analysis at 81
[p_mean, p_median, p_var, hpd_interval, p_deciles, density] = …

Error in ==> posterior_analysis>job at 57
oo_ =
covariance_mc_analysis(SampleSize,‘posterior’,M_.dname,M_.fname,…

Error in ==> posterior_analysis at 32
oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_);

Error in ==> compute_moments_varendo at 64
oo_ =
posterior_analysis(‘variance’,var_list_(i,:),var_list_(j,:),],options_,M_,oo_);

Error in ==> dynare_estimation_1 at 1081
oo_ =
compute_moments_varendo(‘posterior’,options_,M_,oo_,var_list_);

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> brasil_estimacao at 2295
dynare_estimation(var_list_);

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

Please post your MOD file so that we can reproduce the problem.