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: gccmi_ccd.m
    path of file: ./repos/fieldtrip/external/gcmi
    
    the code of the file until where you have to start completion: function [CMI I] = gcmi_ccd(x, y, z, Zm)
% GCCMI_CCD Gaussian-Copula CMI between 2 continuous variables conditioned on 
%           a discrete variable.
%   [CMI I] = gccmi_ccd(x,y,z,Zm) returns the CMI between two (possibly
%   multidimensional) continuous variables, x and y, conditioned on a third 
%   discrete variable, z, estimated via Gaussian copulae.
%   If x and/or y are multivariate rows must correspond to samples, columns
%   to dimensions/variables. (Samples first axis) 

    
function [CMI I] = gcmi_ccd(x, y, z, Zm)
% GCCMI_CCD Gaussian-Copula CMI between 2 continuous variables conditioned on 
%           a discrete variable.
%   [CMI I] = gccmi_ccd(x,y,z,Zm) returns the CMI between two (possibly
%   multidimensional) continuous variables, x and y, conditioned on a third 
%   discrete variable, z, estimated via Gaussian copulae.
%   If x and/or y are multivariate rows must correspond to samples, columns
%   to dimensions/variables. (Samples first axis) 
%   z should contain integer values in the range [0 Zm-1] (inclusive).
%   In addition to the CMI, the variable I is returned which is the pooled MI
%   calculated with the copula transform performed within each class

% ensure samples first axis for vectors
if isvector(x)
    x = x(:);
end