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: merge_atlases.m
    path of file: ./repos/CanlabCore/CanlabCore/@atlas
    
    the code of the file until where you have to start completion: function atlas_obj = merge_atlases(atlas_obj, atlas_obj_to_add, varargin)
% Add all or some regions from an atlas object to another atlas object (with/without replacing existing labeled voxels)
%
%  atlas_obj = merge_atlases(atlas_obj, atlas_obj_to_add, [optional arguments])
%
% - First input atlas_obj defines space and voxel size
% - By default, values in atlas_obj_to_add are added to probability maps, if available,
%   and highest-probability region determines voxel label.  If probability maps are missing,
%   default is to replace labels in atlas_obj with the ones from the
%   to-be-added atlas.  The 'noreplace' option zeroes out the values in the to-add atlas if they are already
%   in the original atlas, privileging the atlas entered first.
%
%
% Optional arguments:
% Inputs to select_atlas_subset, e.g., vector of region numbers or cell array of region names
%  e.g., [1 3], {'VPL' 'IFG'}
%
% 'noreplace' : Do not replace voxels in original atlas; see above.
% 'always_replace' : always replace voxels in original atlas; see above.

% -------------------------------------------------------------------------
% DEFAULTS AND INPUTS

    
function atlas_obj = merge_atlases(atlas_obj, atlas_obj_to_add, varargin)
% Add all or some regions from an atlas object to another atlas object (with/without replacing existing labeled voxels)
%
%  atlas_obj = merge_atlases(atlas_obj, atlas_obj_to_add, [optional arguments])
%
% - First input atlas_obj defines space and voxel size
% - By default, values in atlas_obj_to_add are added to probability maps, if available,
%   and highest-probability region determines voxel label.  If probability maps are missing,
%   default is to replace labels in atlas_obj with the ones from the
%   to-be-added atlas.  The 'noreplace' option zeroes out the values in the to-add atlas if they are already
%   in the original atlas, privileging the atlas entered first.
%
%
% Optional arguments:
% Inputs to select_atlas_subset, e.g., vector of region numbers or cell array of region names
%  e.g., [1 3], {'VPL' 'IFG'}
%
% 'noreplace' : Do not replace voxels in original atlas; see above.
% 'always_replace' : always replace voxels in original atlas; see above.

% -------------------------------------------------------------------------
% DEFAULTS AND INPUTS
% -------------------------------------------------------------------------

doreplacevoxels = true;
doverbose = true;
always_replace = false;

% Find optional text strings and replace
for i = 1:length(varargin)
    
    if iscell(varargin{i})
        % will be passed in to select_atlas_subset
        
    elseif isnumeric(varargin{i})
        % will be passed in to select_atlas_subset
        
    elseif ischar(varargin{i})
        switch varargin{i}
            
            case 'always_replace', always_replace = true; varargin{i} = [];
            case 'noreplace', doreplacevoxels = false; varargin{i} = [];
            case 'noverbose', doverbose = false; varargin{i} = [];
                
            otherwise , warning(['Unknown input string option:' varargin{i}]);
        end