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: add_matrix.m
    path of file: ./repos/bspm/thirdparty/spm8/@slover
    
    the code of the file until where you have to start completion: function obj = add_matrix(obj, mat3d, mat, imgno)
% adds 3d matrix image vol to slice overlay 
% FORMAT obj = add_matrix(imgno, mat3d, mat)
%
% Inputs
% obj          - object

    
function obj = add_matrix(obj, mat3d, mat, imgno)
% adds 3d matrix image vol to slice overlay 
% FORMAT obj = add_matrix(imgno, mat3d, mat)
%
% Inputs
% obj          - object
% mat3d        - 3D matrix to add as img
% mat          - optional 4x4 voxel->world translation
% imgno        - optional img no to add to (defaults to last in object)
% 
% Ouputs
% obj          - modified object
%
% $Id: add_matrix.m,v 1.1 2005/04/20 15:05:36 matthewbrett Exp $

if nargin < 2
  return
end