I want to pad zeros in the the array of 126*126 ... how to do it... ??
Show older comments
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)
Image Analyst
on 25 Nov 2013
If you have the Image Processing Toolbox, you can use padarray:
out = padarray(m, 1, 'both');
Roger Stafford
on 25 Nov 2013
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
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!