フィルターのクリア

zero padding in matrix

27 ビュー (過去 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 Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by