padarray               package:matlab               R Documentation

_M_A_T_L_A_B _p_a_d_a_r_r_a_y _f_u_n_c_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Pad array.

_U_s_a_g_e:

     padarray(A, padsize, padval = 0, direction = c("both", "pre", "post"))

_A_r_g_u_m_e_n_t_s:

       A: vector, matrix, or array to be padded

 padsize: integer vector specifying both amount of padding and the
          dimension along which to add it

  padval: scalar value specifying pad value, which defaults to 0. 
           Instead, it may specify the method used to determine pad
          values. 
           Valid values for the method are:

            '"circular"'   pad with circular repetition of elements within the dimension
            '"replicate"'  pad by repeating border elements of array
            '"symmetric"'  pad array with mirror reflections of itself

direction: character string specifying direction to apply padding. 
           Valid values are:

            '"both"'  pad before first element and after last array element along each dimension
            '"pre"'   pad after last array element along each dimension
            '"post"'  pad before first array element along each dimension

_D_e_t_a_i_l_s:

     This is an S4 generic function.

_V_a_l_u_e:

     Return value is the same type as argument 'A' with requested
     padding.

_A_u_t_h_o_r(_s):

     P. Roebuck, roebuck@mdanderson.org

_E_x_a_m_p_l_e_s:

     padarray(1:4, c(0, 2))                          # 0 0 [1 2 3 4] 0 0
     padarray(1:4, c(0, 2), -1)                      # -1 -1 [1 2 3 4] -1 -1
     padarray(1:4, c(0, 2), -1, "post")              # [1 2 3 4] -1 -1
     padarray(1:4, c(0, 3), "symmetric", "pre")      # 3 2 1 [1 2 3 4]
     padarray(letters[1:5], c(0, 3), "replicate")    # a a a [a b c d e] e e e
     padarray(letters[1:5], c(0, 3), "circular", "post")     # [a b c d e] a b c

