matlab循环向量化
我想知道是否有人可以帮助我矢量化这些 for 循环,我已经尝试过几次但无法提前致谢。
pixel_depth = 16;
pixel_range = 2^pixel_depth -1;
for i=1:height
for j=1:width
for k=1:gaussianComponents
mean(i,j,k) = rand*pixel_range;
weights(i,j,k) = 1/gaussianComponents;
pixelDeviation(i,j,k) = diviationNew;
end
end
end
谢谢您的帮助....
I was wondering if anyone could help me vectorize these for loops I have attempt a few time but have not been able to thanks in advance.
pixel_depth = 16;
pixel_range = 2^pixel_depth -1;
for i=1:height
for j=1:width
for k=1:gaussianComponents
mean(i,j,k) = rand*pixel_range;
weights(i,j,k) = 1/gaussianComponents;
pixelDeviation(i,j,k) = diviationNew;
end
end
end
Thank you for any help....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请注意,
mean
对于变量来说是一个不好的名称,因为它会隐藏mean
函数。Note that
mean
is a bad name for a variable, as it will hide themean
function.