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_ccf2mar.m
    path of file: ./repos/spm12/toolbox/spectral
    
    the code of the file until where you have to start completion: function [mar,pcond] = spm_ccf2mar(ccf,p)
% Converts cross covariance function to cross spectral density
% FORMAT [mar] = spm_ccf2mar(ccf,p)
%
% ccf  (N,m,m)   - cross covariance functions
% p              - AR(p) order
%
% mar.noise_cov  - (m,m)         covariance of innovations   
% mar.mean       - (p*m,m)       MAR coeficients (matrix format - positive)
% mar.lag        - lag(p).a(m,m) MAR coeficients (array format  - negative)
% mar.p          - order of a AR(p) model
%
% See also:
%  spm_ccf2csd.m, spm_ccf2mar, spm_csd2ccf.m, spm_csd2mar.m, spm_mar2csd.m,
%  spm_csd2coh.m, spm_dcm_mtf.m, spm_Q.m, spm_mar.m and spm_mar_spectral.m
%
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging


    
function [mar,pcond] = spm_ccf2mar(ccf,p)
% Converts cross covariance function to cross spectral density
% FORMAT [mar] = spm_ccf2mar(ccf,p)
%
% ccf  (N,m,m)   - cross covariance functions
% p              - AR(p) order
%
% mar.noise_cov  - (m,m)         covariance of innovations   
% mar.mean       - (p*m,m)       MAR coeficients (matrix format - positive)
% mar.lag        - lag(p).a(m,m) MAR coeficients (array format  - negative)
% mar.p          - order of a AR(p) model
%
% See also:
%  spm_ccf2csd.m, spm_ccf2mar, spm_csd2ccf.m, spm_csd2mar.m, spm_mar2csd.m,
%  spm_csd2coh.m, spm_dcm_mtf.m, spm_Q.m, spm_mar.m and spm_mar_spectral.m
%
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: spm_ccf2mar.m 6254 2014-11-04 18:24:21Z karl $


% MAR coeficients
%==========================================================================
N     = size(ccf,1);
m     = size(ccf,2);
n     = (N - 1)/2;
p     = min(p,n - 1);
ccf   = ccf((1:n) + n,:,:);

% create ccf matrices
%--------------------------------------------------------------------------
warning('off','MATLAB:toeplitz:DiagonalConflict')
A     = cell(m,m);
B     = cell(m,m);
for i = 1:m
    for j = 1:m
        A{i,j} = ccf((1:p) + 1,i,j);
        B{i,j} = toeplitz(ccf((1:p),i,j),ccf((1:p),j,i));
    end