From 3fed17a5221bab6a78cbf6b74b14df644abce45a Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Fri, 20 Sep 2024 09:55:27 +0200
Subject: [PATCH] :bug: hssmc.m: make sure no stale files are kept

Would cause crash in subsequent loading of output files as naming would be different
---
 matlab/estimation/smc/hssmc.m | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/matlab/estimation/smc/hssmc.m b/matlab/estimation/smc/hssmc.m
index 6723f931a..888e63256 100644
--- a/matlab/estimation/smc/hssmc.m
+++ b/matlab/estimation/smc/hssmc.m
@@ -38,6 +38,8 @@ function mdd = hssmc(TargetFun, mh_bounds, dataset_, dataset_info, options_, M_,
 
     % Set location for the simulated particles.
     SimulationFolder = CheckPath('hssmc', M_.dname);
+    %delete old stale files before creating new ones
+    delete_stale_file(sprintf('%s%sparticles-*.mat', SimulationFolder,filesep))
 
     % Define prior distribution
     Prior = dprior(bayestopt_, options_.prior_trunc);
-- 
GitLab