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: r2t.m
    path of file: ./repos/Robotics-Toolbox/rvctools/release10.3.1/robot
    
    the code of the file until where you have to start completion: %R2T Convert rotation matrix to a homogeneous transform
%
% T = R2T(R) is an SE(2) or SE(3) homogeneous transform equivalent to an
% SO(2) or SO(3) orthono
    
function T = r2t(R)
    
    % check dimensions: R is SO(2) or SO(3)
    d = size(R);
    assert(d(1) == d(2), 'RTB:r2t:badarg', 'matrix must be square');
    assert(any(d(1) == [2 3]), 'RTB:r2t:badarg', 'argument is not a rotation matrix (sequence)');
    
    Z = zeros(d(1),1);
    B = [Z' 1];
    
    if numel(d) == 2
        % single matrix case
        T = [R Z; B];
    else
        %  matrix sequence case
        T = zeros(4,4,d(3));
        for i=1:d(3)
            T(:,:,i) = [R(:,:,i) Z; B];
        end