How to add boundary to a matrix

append, matlab, matrix

Solution

`padarray` implementation -

%// pad ones on left-right and then pad zeros on top-bottom
B = padarray(padarray(A,[0 1],1),[1 0],0)

Problem

I am quite new to MATLAB. I would like to know how can I transfer the matrix `A` to matrix `B` as shown below? ``` A = 1 2 3 4 5 6 B=0 0 0 0 1 1 2 1 1 3 4 1 1 5 6 1 0 0 0 0 ``` Essentially I would like to add a boundary to `A`. Thank you!

Original source