diff --git a/matlab/estimation/smc/hssmc.m b/matlab/estimation/smc/hssmc.m index 84e0277ed45ff4eaa21f4424477a89e8fa353d74..d47518744ffbd637e83a8ce8215c7387b4cab6af 100644 --- a/matlab/estimation/smc/hssmc.m +++ b/matlab/estimation/smc/hssmc.m @@ -107,8 +107,12 @@ function mdd = hssmc(TargetFun, mh_bounds, dataset_, dataset_info, options_, M_, iresample = kitagawa(weights); particles = particles(:,iresample); end - save(sprintf('%s%sparticles-%u-%u.mat', SimulationFolder, filesep(), i, smcopt.steps), 'particles', 'tlogpostkernel', 'loglikelihood') - resampled_particle_swarm = false; + if resampled_particle_swarm + save(sprintf('%s%sparticles-%u-%u.mat', SimulationFolder, filesep(), i, smcopt.steps), 'particles', 'tlogpostkernel', 'loglikelihood') + resampled_particle_swarm = false; + else + save(sprintf('%s%sparticles-%u-%u.mat', SimulationFolder, filesep(), i, smcopt.steps), 'particles', 'tlogpostkernel', 'loglikelihood', 'weights') + end end end