MATLAB Answers

zero padding in matrix

285 views (last 30 days)
Hi, I have a 5x5 matrix and i would like to pad it with zeros such that its size becomes 200x200 and the 5x5 matrix is in the middle of the 200x200. Please help.
  1 Comment
Roger Stafford
Roger Stafford on 29 Apr 2016
You can't precisely center a 5x5 block in a 200x200 block! In which direction do you want it to be off-center?

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 29 Apr 2016
a=magic(5) % example

More Answers (1)

Anvinder  Singh
Anvinder Singh on 29 Apr 2016
Just struck my brain ! Thanks Azzi Abdelmalek for the quick response.

Community Treasure Hunt

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

Start Hunting!