零填充矩阵 [英] zero padding a matrix

查看:92
本文介绍了零填充矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个16X16的矩阵.我必须将其添加到256X256矩阵中.谁能帮我把16X16矩阵变成256X256并用零填充其余部分?

I have a 16X16 matrix. I have to add it to a 256X256 matrix. Can anyone help me how to make this 16X16 matrix into 256X256 filling the remaining with zeros?

推荐答案

如果您为原始尺寸以外的元素分配内容,Matlab将自动填充零.

Matlab automatically pads with zeros if you assign something to an element outside of the original size.

>> A = rand(16, 16);
>> A(256, 256) = 0;
>> size(A)
ans =
   256   256

这篇关于零填充矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆