Borrar filtros
Borrar filtros

zero padding in matrix

33 visualizaciones (últimos 30 días)
Anvinder  Singh
Anvinder Singh el 29 de Abr. de 2016
Comentada: Rohit Kharat el 20 de En. de 2022
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 comentario
Roger Stafford
Roger Stafford el 29 de Abr. de 2016
You can't precisely center a 5x5 block in a 200x200 block! In which direction do you want it to be off-center?

Iniciar sesión para comentar.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 29 de Abr. de 2016
a=magic(5) % example
b=zeros(200)
b(98:102,98:102)=a
  1 comentario
Rohit Kharat
Rohit Kharat el 20 de En. de 2022
Any generalization to above?

Iniciar sesión para comentar.

Más respuestas (1)

Anvinder  Singh
Anvinder Singh el 29 de Abr. de 2016
Just struck my brain ! Thanks Azzi Abdelmalek for the quick response.

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by