MATLAB: Adding a frame of zeros to a matrix

Image Processing Toolboxmatrix zeros plot

I have a matrix 19×9 I want to add a frame of zeros so I will be 20×10 ?????

Best Answer

Not sure which corner you want to pad with zeros. I'm assuming bottom right:
newmatrix = [yourmatrix, zeros(size(yourmatrix, 1), 1); zeros(1, size(yourmatrix, 2) + 1)];
If you have the image processing toolbox:
newmatrix = padarray(yourmatrix, [1 1], 'direction', 'post');