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: is_terminal.m
    path of file: ./repos/QlearningProject/Policy-II/Episodic_q_learning_position_as state
    
    the code of the file until where you have to start completion: function [ terminal,reward ] = is_terminal( i,j,maze )
%IS_NON_TERMINAL This function checks whether [i, j] is a terminal state or not
%   
%   
    %r=[10 0 0 0];
    %r=[10 5 -5 -10];
    %All the cells in the last column are terminal states

%%%here we define the terminal state

    
function [ terminal,reward ] = is_terminal( i,j,maze )
%IS_NON_TERMINAL This function checks whether [i, j] is a terminal state or not
%   
%   
    %r=[10 0 0 0];
    %r=[10 5 -5 -10];
    %All the cells in the last column are terminal states

%%%here we define the terminal state

    term_state = find(maze(:,:)'==3);
    [nr nc] = size(maze);
    
    tr = ceil(term_state/nc);
    tc = mod(term_state,nc);
    if tc==0
       tc = nc;
    end