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: xASL_imp_DCM2NII_ConvertScan.m
    path of file: ./repos/ExploreASL/Functions/Import
    
    the code of the file until where you have to start completion: function [x, thisSubject, dcm2niiCatchedErrors, PrintDICOMFields] = xASL_imp_DCM2NII_ConvertScan(x, matches, thisSubject, dcm2niiCatchedErrors, thisVisit, thisRun, scanFields)
%xASL_imp_DCM2NII_ConvertScan Run DCM2NII for one individual scan.
%
% FORMAT: [x, thisSubject, dcm2niiCatchedErrors, PrintDICOMFields] = xASL_imp_DCM2NII_ConvertScan(x, matches, thisSubject, dcm2niiCatchedErrors, thisVisit, thisRun, scanFields)
% 
% INPUT:
%   x                      - ExploreASL x structure (REQUIRED, STRUCT)
%   matches                - matched files with tokens (REQUIRED, CELL ARRAY OF CHARS)
%   thisSubject            - current iteration subjectID (REQUIRED, INTEGER)
%   thisVisit              - current iteration visit (REQUIRED, INTEGER)
%   thisRun                - current iteration run (REQUIRED, INTEGER)
%   dcm2niiCatchedErrors   - DCM2NII catched errors (STRUCT, REQUIRED)
%   scanFields             - struct containing iSubject, iVisit, iSession, iScan (REQUIRED)
%
%   x.modules.import.imPar - Structure with import parameters (STRUCT, REQUIRED)
%
% OUTPUT:
%   x                      - ExploreASL x structure
%   thisSubject            -
%   dcm2niiCatchedErrors   -
%   PrintDICOMFields       - 
%                         
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% DESCRIPTION: Run DCM2NII for one individual scan.
%
% 4. Iterate over scans
% -  1. Initialize variables (scanID, summary_line, first_match)
% -  2. Convert scan ID to a suitable name and set scan-specific parameters
% -  3. Minimalistic feedback of where we are
% -  4. Now pick the matching one from the folder list
% -  5. Determine input and output paths
% -  6. Start the conversion if this scan should not be skipped
% -  7. Store JSON files
% -  8. In case of a single NII ASL file loaded from PAR/REC, we need to shuffle the dynamics from CCCC...LLLL order to CLCLCLCL... order
% -  9  Copy single dicom as QC placeholder
% - 10. Store the summary info so it can be sorted and printed below
%
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% EXAMPLE:     n/a
% __________________________________
% Copyright 2015-2023 ExploreASL


    %% 4.1 Initialize variables
    
    PrintDICOMFields = [];
    
    % Get other basic fields
    scanID = thisRun.scanIDs{scanFields.iScan};

    
function [x, thisSubject, dcm2niiCatchedErrors, PrintDICOMFields] = xASL_imp_DCM2NII_ConvertScan(x, matches, thisSubject, dcm2niiCatchedErrors, thisVisit, thisRun, scanFields)
%xASL_imp_DCM2NII_ConvertScan Run DCM2NII for one individual scan.
%
% FORMAT: [x, thisSubject, dcm2niiCatchedErrors, PrintDICOMFields] = xASL_imp_DCM2NII_ConvertScan(x, matches, thisSubject, dcm2niiCatchedErrors, thisVisit, thisRun, scanFields)
% 
% INPUT:
%   x                      - ExploreASL x structure (REQUIRED, STRUCT)
%   matches                - matched files with tokens (REQUIRED, CELL ARRAY OF CHARS)
%   thisSubject            - current iteration subjectID (REQUIRED, INTEGER)
%   thisVisit              - current iteration visit (REQUIRED, INTEGER)
%   thisRun                - current iteration run (REQUIRED, INTEGER)
%   dcm2niiCatchedErrors   - DCM2NII catched errors (STRUCT, REQUIRED)
%   scanFields             - struct containing iSubject, iVisit, iSession, iScan (REQUIRED)
%
%   x.modules.import.imPar - Structure with import parameters (STRUCT, REQUIRED)
%
% OUTPUT:
%   x                      - ExploreASL x structure
%   thisSubject            -
%   dcm2niiCatchedErrors   -
%   PrintDICOMFields       - 
%                         
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% DESCRIPTION: Run DCM2NII for one individual scan.
%
% 4. Iterate over scans
% -  1. Initialize variables (scanID, summary_line, first_match)
% -  2. Convert scan ID to a suitable name and set scan-specific parameters
% -  3. Minimalistic feedback of where we are
% -  4. Now pick the matching one from the folder list
% -  5. Determine input and output paths
% -  6. Start the conversion if this scan should not be skipped
% -  7. Store JSON files
% -  8. In case of a single NII ASL file loaded from PAR/REC, we need to shuffle the dynamics from CCCC...LLLL order to CLCLCLCL... order
% -  9  Copy single dicom as QC placeholder
% - 10. Store the summary info so it can be sorted and printed below
%
% -----------------------------------------------------------------------------------------------------------------------------------------------------
% EXAMPLE:     n/a
% __________________________________
% Copyright 2015-2023 ExploreASL


    %% 4.1 Initialize variables
    
    PrintDICOMFields = [];
    
    % Get other basic fields
    scanID = thisRun.scanIDs{scanFields.iScan};
    summary_line = [];
    thisSubject.summary_lines{scanFields.iSubject, scanFields.iVisit, scanFields.iSession, scanFields.iScan} = 'n/a';
    
    % If not verbose, track percentage progress
    if ~x.modules.import.imPar.bVerbose
        CounterN = (scanFields.iSession-1)*thisVisit.nScans+scanFields.iScan;
        CounterT = thisVisit.nSessions*thisVisit.nScans;
        xASL_TrackProgress(CounterN, CounterT);
    end