Using Dynare as a Matlab function

Hello Johannes and all,
How would I write a Matlab script calling Dynare as a function? What would be the proper syntax? I have in mind the following algorithm:

model <- model_file.mod; (without some parameter values)
x <- parameter values;
run dynare (model,x);
y <- oo_.dr

I need to collect oo_.dr for different models and parameter values automatically. How can I implement this algorithm in Matlab?

Please see Loop over parameters

Will do. Thanks.