MATLAB: Copying non zero matrix to a zeros matrix MATLABmatrixmatrix manipulation 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! Best Answer 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 Related SolutionsMATLAB: Matrix Zero padding for filter (image processing) a = ones(5);out = zeros(size(a)*2-1);out(1:2:end,1:2:end) = a; MATLAB: Zeros matrix Huh?doc zerosMaybe:zeros(n)orzeros(n,n,k) Related QuestionPadding an array with some size, and the locationAdding zeros to matrixAdd column vector with for loopsMatrix padding with zeroHow to get the columns of non zero matrixMatrix recording zerosChange Index of non-zero values in 3D arrayZero padding
Best Answer