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: trim_mask.m
    path of file: ./repos/CanlabCore/CanlabCore/@image_vector
    
    the code of the file until where you have to start completion: function obj = trim_mask(obj)
% Exclude empty voxels from mask information in obj.volInfo structure, and re-make obj.volInfo
%
% ..
%    Tor Wager, 2013
% ..

obj = replace_empty(obj);
whomit = all(obj.dat == 0 | isnan(obj.dat), 2);

    
function obj = trim_mask(obj)
% Exclude empty voxels from mask information in obj.volInfo structure, and re-make obj.volInfo
%
% ..
%    Tor Wager, 2013
% ..

obj = replace_empty(obj);
whomit = all(obj.dat == 0 | isnan(obj.dat), 2);

obj.dat(whomit, :) = [];
if ~isempty(obj.removed_voxels) && length(obj.removed_voxels) == obj.volInfo.n_inmask
    obj.removed_voxels(whomit) = [];
end