[英]Vectorize 3d operation in matlab
Can you vectorize a operation where the columns of U are added to cwx and the result is stored in a 3d array? 您能否对将U的列添加到cwx并将结果存储在3d数组中的操作进行矢量化处理?
A non-vectorized solution: 非矢量化解决方案:
cwx =rand([500,100]);
U = rand([500 10]);
F = zeros([500 100 10]);
for y = 1:10
F(:,:,y) = bsxfun(@plus,U(:,y),cwx);
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.