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: CBIG_ComputeSeedBasedCorrelation.m
    path of file: ./repos/CBIG/utilities/matlab/FC
    
    the code of the file until where you have to start completion: function output = CBIG_ComputeSeedBasedCorrelation(seed_file_txt, target_file_txt, seed_mask_file, target_mask_file, type, output_file)

% output = CBIG_ComputeSeedBasedCorrelation(seed_file_txt, target_file_txt, seed_mask_file, target_mask_file, type, output_file)
%
% seed_file_txt is list of files that are time series to be used as seed regions
% target_file_txt is list of files that are time series to be used as target regions
% seed_mask_file is a single file that is a binary mask defining the seed
% target_mask_file is a single file that is a binary mask defining the region of target time series to perform corrrelation
%
% type can either be "average" or "full": "average" means average results
% across files. "full" means keep the full results.
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md


    
function output = CBIG_ComputeSeedBasedCorrelation(seed_file_txt, target_file_txt, seed_mask_file, target_mask_file, type, output_file)

% output = CBIG_ComputeSeedBasedCorrelation(seed_file_txt, target_file_txt, seed_mask_file, target_mask_file, type, output_file)
%
% seed_file_txt is list of files that are time series to be used as seed regions
% target_file_txt is list of files that are time series to be used as target regions
% seed_mask_file is a single file that is a binary mask defining the seed
% target_mask_file is a single file that is a binary mask defining the region of target time series to perform corrrelation
%
% type can either be "average" or "full": "average" means average results
% across files. "full" means keep the full results.
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md



% Read in target and seed files
if(strfind(seed_file_txt, '.txt'))
    fid = fopen(seed_file_txt, 'r');
    i = 0;
    while(1);
        tmp = fscanf(fid, '%s\n', 1);
        if(isempty(tmp))
            break
        else
            i = i + 1;
            seed_files{i} = tmp;
        end