Copying non zero matrix to a zeros matrix
7 ビュー (過去 30 日間)
古いコメントを表示
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!
0 件のコメント
採用された回答
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
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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!