Adding zeros to matrix
显示 更早的评论
I have to do image processing. I have one data with 100 x 100 matrix and another with 300 x 300 matrix. I want to add zeros to 100 x100 matrix to equalize it like 300 x300 but zeros to be added after 100 x 100 equally and not in particular end.
采纳的回答
更多回答(1 个)
Let A be your 100*100 matrix.
B = zeros(300) ;
B(1:100,1:100) = A ;
3 个评论
Anjali Sharma
2020-8-5
KSSV
2020-8-5
A = rand(2) ;
[m,n] = size(A) ;
B = zeros(3*m,3*n) ;
B((m+1):2*m,(n+1):2*n) = A ;
Also read about padarray
Anjali Sharma
2020-8-5
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!