Pass a UQLink model to a .m file model

Hi @Gil

You can do what you suggested by passing the UQLink model as parameter of your myFunction model. Basically it would go like:

Mopts.mFile = 'myFunction';
Mopts.Parameters = myUQLinkModel ;
myModel = uq_createModel(Mopts);

Then you can define your model exactly as you have suggested:

function Y = myFunction(X,myUQLinkModel)
...
FEMresult = uq_evalModel(myUQLinkModel,X)
Y = f(FEMresult)
end

The UQLink model is defined in the main configuration file of your analysis, prior to defining myModel.

I think with this change you shouldn’t anymore have multiple models defined.

Generally speaking, also remember that when you have to build a model repetitively in UQLab (which is not the case for your problem here), you can use the options ’-private' as in

myModel = uq_createModel(Mopts,'-private');

to avoid saving in memory intermediate models that were built throughout the analysis.

For UQLink, you can also use the .Archiving option to clear the files created during the FE analysis.

Regarding the AK-MCS issue, that is a bit weird and I can’t reproduce the error from my side. Could you please try again with the updates above and let me know if you still have the same issue?

Cheers,
Moustapha

1 Like