MATLAB: I have a binary image having pixels 288*543

i have a binary image having pixels 288*543

I have a binary image having pixels 288*543(rows and columns). To that i need to assign zeros for 1 row and 1 column surrounding the 288*543. How can i achieve this.can anyone suggest some code for this.
Thank you.

Best Answer

If you have the image processing toolbox, use padarray, otherwise:
newm = zeros(size(m) + 2);
newm(2:end-1, 2:end-1) = m;