I want to pad zeros in the the array of 126*126 ... how to do it... ??

a row of zeros in the start of matrix 126*126 also at the end of it , similarly column of zeros in the start and in the end of matrix 126*126

Answers (2)

If you have the Image Processing Toolbox, you can use padarray:
out = padarray(m, 1, 'both');
Let M be your matrix:
[m,n] = size(M);
M = [zeros(1,n+2);zeros(m,1),M,zero(m,1);zeros(1,n+2)];

Categories

Tags

No tags entered yet.

Asked:

on 25 Nov 2013

Answered:

on 25 Nov 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!