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: ft_statfun_diff.m
    path of file: ./repos/malini/Codes/deconvolution - model/spm8/external/fieldtrip/statfun
    
    the code of the file until where you have to start completion: function [s] = ft_statfun_diff(cfg, dat, design)

% FT_STATFUN_diff computes the difference of the mean in two conditions.
% Although it can be used for statistical testing, it is not very
% usefull since it will have rather limited sensitivity.
% 
% The purpose of this function is to show you an example on how to
% write a statfun that expresses the difference in the data between
% two conditions. You can use such a function with the statistical

    
function [s] = ft_statfun_diff(cfg, dat, design)

% FT_STATFUN_diff computes the difference of the mean in two conditions.
% Although it can be used for statistical testing, it is not very
% usefull since it will have rather limited sensitivity.
% 
% The purpose of this function is to show you an example on how to
% write a statfun that expresses the difference in the data between
% two conditions. You can use such a function with the statistical
% framework in FieldTrip to perform a simple (or more complex)
% permutation test, without having to worry about the representation
% of the data.
%
% See also STATFUN_MEAN for an other example function

% Copyright (C) 2006, Robert Oostenveld 
%
% This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id: ft_statfun_diff.m 7123 2012-12-06 21:21:38Z roboos $

selA = find(design(cfg.ivar,:)==1); % selecton condition 1 or A
selB = find(design(cfg.ivar,:)==2); % selecton condition 2 or B
dfA  = length(selA);
dfB  = length(selB);
if (dfA+dfB)<size(design, 2)
  % there are apparently replications that belong neither to condition 1, nor to condition 2
  warning('inappropriate design, it should only contain 1''s and 2''s');
end