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: spm_vb_robust.m
    path of file: ./repos/spm12
    
    the code of the file until where you have to start completion: function [slice] = spm_vb_robust (Y,slice)
% Robust GLM modelling in a slice of fMRI
% FORMAT [slice] = spm_vb_robust (Y,slice)
%
% Y     -  [T x N] time series with T time points, N voxels
%
% slice -  data structure containing fields described in spm_vb_glmar.m
%
% Requires the 'mixture' toolbox: fullfile(spm('Dir'),'toolbox','mixture')
%__________________________________________________________________________
%
% Reference:
% W.D. Penny, J. Kilner and F. Blankenburg. Robust Bayesian General Linear 
% Models. NeuroImage, 36(3):661-671, 2007.

    
function [slice] = spm_vb_robust (Y,slice)
% Robust GLM modelling in a slice of fMRI
% FORMAT [slice] = spm_vb_robust (Y,slice)
%
% Y     -  [T x N] time series with T time points, N voxels
%
% slice -  data structure containing fields described in spm_vb_glmar.m
%
% Requires the 'mixture' toolbox: fullfile(spm('Dir'),'toolbox','mixture')
%__________________________________________________________________________
%
% Reference:
% W.D. Penny, J. Kilner and F. Blankenburg. Robust Bayesian General Linear 
% Models. NeuroImage, 36(3):661-671, 2007.
%__________________________________________________________________________
% Copyright (C) 2005-2014 Wellcome Trust Centre for Neuroimaging

% Will Penny 
% $Id: spm_vb_robust.m 6079 2014-06-30 18:25:37Z spm $

[T, Nv] = size(Y);
X       = slice.X;
k       = slice.k;

for i=1:Nv,
    
    fprintf('Analysing voxel %d out of %d\n',i,Nv);
    yv=Y(:,i);
    if sum(diff(yv).^2) > 0
        rglm1   = spm_rglm(yv,X,1);
        rglm2   = spm_rglm(yv,X,2);
        logbf21 = rglm2.fm - rglm1.fm;
        w       = rglm2.posts.w_mean;
        lambda  = 1 / rglm1.variances;
        w_dev   = sqrt(diag(rglm2.posts.w_cov));
        w_cov   = rglm2.posts.w_cov;
        gamma   = rglm2.posts.gamma(2,:)';
    else
        w       = zeros(k,1);
        w_dev   = w;
        w_cov   = eye(k,k);
        lambda  = 0;
        logbf21 = 0;
        gamma   = zeros(T,1);
    end