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: CreateCoeffsLoop3d.m
    path of file: ./repos/CutAndDisplace/3dCode/SlipCalculation
    
    the code of the file until where you have to start completion: function [infmatrix,Dinfmatrix]=CreateCoeffsLoop3d(infmatrix,Dinfmatrix,...
    NUM,X,Y,Z,P1,P2,P3,Dss,Dds,Dn,mu,lambda,nu,halfspace,FD)
% CreateCoeffsLoop3d: Loop that calls the TDE functions of Mehdi 
%               Nikkhoo and fills a large column mat with influence

    
function [infmatrix,Dinfmatrix]=CreateCoeffsLoop3d(infmatrix,Dinfmatrix,...
    NUM,X,Y,Z,P1,P2,P3,Dss,Dds,Dn,mu,lambda,nu,halfspace,FD)
% CreateCoeffsLoop3d: Loop that calls the TDE functions of Mehdi 
%               Nikkhoo and fills a large column mat with influence
%               coefficients.
%
% usage #1:
% [infmatrix,DisplacementXYZ]=CreateCoeffsLoop3d(infmatrix,DisplacementXYZ,...
%     NUM,X,Y,Z,P1,P2,P3,Dss,Dds,Dn,mu,lambda,nu,halfspace,FD)
%
% Arguments: (input)
%  infmatrix  - 6*n 'vector' of 0's to be filled with strain coefficients.
%
% Dinfmatrix  - 3*n 'vector' of 0's to be filled with displacement coefficients.
%
%       NUM   - The number of elements in the calculation. 
%
%    X,Y,Z    - The element midpoints (triangle). (col vec, XYZ)
%
% P1,P2,P3    - n*3 Column vectors where each 'P' represents the
%               different corner points of one of the triangles (XYZ).
%
% Dss,Dds,Dn  - One will be one and the others 0, depend