필터 지우기
필터 지우기

zero padding in matrix

조회 수: 32 (최근 30일)
Anvinder  Singh
Anvinder Singh 2016년 4월 29일
댓글: Rohit Kharat 2022년 1월 20일
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
Roger Stafford
Roger Stafford 2016년 4월 29일
You can't precisely center a 5x5 block in a 200x200 block! In which direction do you want it to be off-center?

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 29일
a=magic(5) % example
b=zeros(200)
b(98:102,98:102)=a
  댓글 수: 1
Rohit Kharat
Rohit Kharat 2022년 1월 20일
Any generalization to above?

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Anvinder  Singh
Anvinder Singh 2016년 4월 29일
Just struck my brain ! Thanks Azzi Abdelmalek for the quick response.

카테고리

Help CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by