Hello everyone,

I defined a computational model through a .m file function. The function takes the random input X and gives the output Y. In the .m file, I define a UQLink model (which links UQLab to a FEM software) and I use the result of the FEM analysis (the FEM result is extracted thanks to a parser and is a scalar) as input for another computation which is implemented in the .m file. So the output Y is dependent on my FEM result and from other computations performed in the .m file. The problem is, that a new UQLink model is created each time the .m file function is called (at the end of the analysis I have in the folder many .mat files and .zip files called Model1, Model2, …, ModelN). Is there a way, to define the UQLink model outside the .m function and pass it, so that I only have to keep in the .m file the line which starts the FEM analysis? Something like:

`function Y = myFunction(X,myUQLinkModel)`

`...`

`FEMresult = uq_evalModel(myUQLinkModel,X)`

`Y = f(FEMresult)`

`end`

Another problem I have, is that if I perform an AKMCS, even if I limit the max added samples, say MaxAdded = 30, it runs forever and doesn’t stop. But I don’t know if it is related with the problem of having a new UQLink model each time the function Y is called.

Thank you!