You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: res2par.m
    path of file: ./repos/mcmcstat
    
    the code of the file until where you have to start completion: function params = res2par(res,params,loc)
%RES2PAR utility for mcmc tbx 
% copy results.theta to theta struct

    
function params = res2par(res,params,loc)
%RES2PAR utility for mcmc tbx 
% copy results.theta to theta struct
% params = res2par(res,params)

% $Revision: 1.5 $  $Date: 2008/11/19 15:05:49 $

if nargin<3
  loc=1; % do locals
end