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: patch_operation.m
    path of file: ./repos/toolkit-legacy/utilities
    
    the code of the file until where you have to start completion: function [new, mask] = patch_operation(matrix, patch, offset, operation)
% patch_operation Performs a point-wise operation with two unequal matrices
%
% Performs a point-wise operation (e.g. assignment, arithmetic) between two matrices
% that are not of the same size with a given offset. The result has the size of the 
% first matrix and the outlying elements are left intact.
%
% Input:
% - matrix (matrix): First operand matrix.
% - patch (matrix): Second operand matrix.
% - offset (vector): Two-element vector that defines the row and column offset of the second operand.
% - operation (char): A char that defines the type of the operation.
%     - '+': addition
%     - '-': subraction
%     - '*': multiplication
%     - '/': division
%     - '=': assignment

    
function [new, mask] = patch_operation(matrix, patch, offset, operation)
% patch_operation Performs a point-wise operation with two unequal matrices
%
% Performs a point-wise operation (e.g. assignment, arithmetic) between two matrices
% that are not of the same size with a given offset. The result has the size of the 
% first matrix and the outlying elements are left intact.
%
% Input:
% - matrix (matrix): First operand matrix.
% - patch (matrix): Second operand matrix.
% - offset (vector): Two-element vector that defines the row and column offset of the second operand.
% - operation (char): A char that defines the type of the operation.
%     - '+': addition
%     - '-': subraction
%     - '*': multiplication
%     - '/': division
%     - '=': assignment
%
% Output:
% - new (matrix): Resulting matrix.
% - mask (matrix): Binary mask of the elements that were affected by the operation.
%


if nargin < 4
    operation = '=';
end