My array size is 32 x 240,now i want to pad zeros to make it as 192 x 240.How to do it using matlab code
1 次查看(过去 30 天)
显示 更早的评论
x = [zeros(floor(ls/2),n) x zeros(ceil(ls/2),n)];
i am getting error as
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
so i checked size of all 3.i.e size of zeros(floor(ls/2),n) is 32 x 240, whereas size of zeros(ceil(ls/2),n) is 32x240. size of x is 192:240.
采纳的回答
Walter Roberson
2015-7-31
x = [zeros(floor(ls/2),n); x; zeros(ceil(ls/2),n)];
6 个评论
Walter Roberson
2015-8-1
For simplicity, I suggest that you use zeros() with the size of the desired output matrix, and then you copy the input matrix to the appropriate location in the output matrix. For example:
strow = 17; stcol = 53;
outmatrix = zeros(256, 256);
outmatrix(strow + (1:size(inputmatrix,1) - 1, stcol + (1:size(inputmatrix,2) - 1) = inputmatrix;
This would put inputmatrix into a 256 x 256 matrix with upper left corner) at outputmatrix(17,53)
I have no present information as to the size of matrix required for the toolbox you are using.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!