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_Q_perm.m
    path of file: ./repos/bspm/thirdparty/spm8
    
    the code of the file until where you have to start completion: function p = spm_Q_perm(Q)
% returns a cell of permutation indices for separating matrices
% FOTMAT p = spm_Q_perm(Q);
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

    
function p = spm_Q_perm(Q)
% returns a cell of permutation indices for separating matrices
% FOTMAT p = spm_Q_perm(Q);
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
 
% John Ashburner & Karl Friston
% $Id: spm_Q_perm.m 3657 2009-12-23 20:22:10Z karl $
 
 
% add cell arrays of components
%--------------------------------------------------------------------------
A   = 0;
if iscell(Q)
    for i = 1:length(Q)
        A = A + ~~Q{i};
    end