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: make_mean_sample.m
    path of file: ./repos/CaImAn-MATLAB/deconvolution/MCMC/utilities
    
    the code of the file until where you have to start completion: function c_m = make_mean_sample(SAMPLES,Y)

% construct mean calcium sample from samples structure SAMPLES

% Inputs:
% SAMPLES:      samples struct output of cont_ca_sampler
% Y:            observed fluorescence trace

    
function c_m = make_mean_sample(SAMPLES,Y)

% construct mean calcium sample from samples structure SAMPLES

% Inputs:
% SAMPLES:      samples struct output of cont_ca_sampler
% Y:            observed fluorescence trace

% Output:
% c_m:          mean calcium sample

% Author: Eftychios A. Pnevmatikakis, 2016, Simons Foundation.

T = length(Y);
N = length(SAMPLES.ns);
P = SAMPLES.params;
P.f = 1;
g = P.g(:);
Dt = 1/P.f;                                     % length of time bin
if ~isfield(SAMPLES,'g');
    SAMPLES.g = ones(N,1)*g';
end