필터 지우기
필터 지우기

Copying non zero matrix to a zeros matrix

조회 수: 2 (최근 30일)
Steve
Steve 2012년 4월 28일
Hello Dear Experts,
Consider I have a non zero matrix A of size m x n.
I want to pad it with zeros on all sizes. What is the smartest way to pad it with p zero rows and q zero columns.
Thanks a lot in advance!

채택된 답변

bym
bym 2012년 4월 28일
a = magic(3);
padarray(a,[2 1])
ans =
0 0 0 0 0
0 0 0 0 0
0 8 1 6 0
0 3 5 7 0
0 4 9 2 0
0 0 0 0 0
0 0 0 0 0
  댓글 수: 2
Image Analyst
Image Analyst 2012년 4월 28일
It's in the Image Processing Toolbox. Type ver on the command line to see if you are so unfortunate that you don't have it.
Steve
Steve 2012년 4월 28일
Thanks you both, just forgot the padding function.
My pleasure to have your answers, dear Experts!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by