Blanchard-Kahn flag stored?

Dear All,

I face the following problem. I am trying to implement a random walk Metropolis Hastings algorithm where
for each new draw of parameters the model is solved by Dynare. However, when for the proposed set of parameters
Blanchard-Kahn conditions are not satisfied, the whole procedure stops. Ideally, I would like to implement that
whenever BK conditions are not satisfied, the proposed parameters are not chosen. Do you know a way
to do this? For example, how could I let Dynare check BK and return the flag? Thank you for your help in advance.

Use Matlab’s try-catch routine.

Thank you for your help.