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: copy_to_derivative.m
    path of file: ./repos/ExploreASL/External/bids-matlab/+bids
    
    the code of the file until where you have to start completion: function copy_to_derivative(BIDS, out_path, pipeline_name, filter, unzip, force, skip_dep, use_schema, verbose)
  %
  % Copy selected data from BIDS layout to given derivatives folder,
  % returning layout of new derivatives folder
  %
  % USAGE::
  %
  %   derivatives = copy_to_derivative(BIDS, out_path, query)
  %
  % :param BIDS:          BIDS directory name or BIDS structure (from bids.layout)
  % :type  BIDS:          structure or string
  % :param out_path:      path to directory containing the derivatives
  % :type  out_path:      string
  % :param pipeline_name: name of pipeline to use
  % :type  pipeline_name: string
  % :param query:         list of filters to choose what files to copy (see bids.query)
  % :type  query:         structure or cell
  % :param unzip:         If ``true`` (default) then all ``.gz`` files will be unzipped
  %                       after being copied.
  % :type  unzip:         boolean

    
function copy_to_derivative(BIDS, out_path, pipeline_name, filter, unzip, force, skip_dep, use_schema, verbose)
  %
  % Copy selected data from BIDS layout to given derivatives folder,
  % returning layout of new derivatives folder
  %
  % USAGE::
  %
  %   derivatives = copy_to_derivative(BIDS, out_path, query)
  %
  % :param BIDS:          BIDS directory name or BIDS structure (from bids.layout)
  % :type  BIDS:          structure or string
  % :param out_path:      path to directory containing the derivatives
  % :type  out_path:      string
  % :param pipeline_name: name of pipeline to use
  % :type  pipeline_name: string
  % :param query:         list of filters to choose what files to copy (see bids.query)
  % :type  query:         structure or cell
  % :param unzip:         If ``true`` (default) then all ``.gz`` files will be unzipped
  %                       after being copied.
  % :type  unzip:         boolean
  %
  % All the metadata of each file is read through the whole hierarchy
  % and dumped into one side-car json file for each file copied.
  % In practice this "unravels" the inheritance principle.
  %
  %
  % __________________________________________________________________________
  %
  % BIDS (Brain Imaging Data Structure): https://bids.neuroimaging.io/
  %   The brain imaging data structure, a format for organizing and
  %   describing outputs of neuroimaging experiments.
  %   K. J. Gorgolewski et al, Scientific Data, 2016.
  % __________________________________________________________________________

  % Copyright (C) 2016-2018, Guillaume Flandin, Wellcome Centre for Human Neuroimaging
  % Copyright (C) 2021--, BIDS-MATLAB developers

  narginchk(2, Inf);

  if nargin < 3
    pipeline_name = 'bids-matlab';
  end