Ältere Kommentare anzeigen
有一个数据A 格式是x*y*z*t
相当于经度、维度、高度、时间维
有一个数组B,格式是x*y,经度*维度
现在要对数组A 每一个网格平面与数组B相乘
我只会下面这种循环切片的方式,效率很低,请问有别的方法吗?
for iz = 1:z
for it = 1 : t
C(:,:,iz,it) = squueze(A(:,:,iz,it)) .* B
end
end
%--------更新
目前想到一个方法,把数组B 复制扩充 ,这样数组A和数组B规格相同,直接矩阵相乘可
B0 = repmat(B, [1,1,z,t]);
C = A.* B0
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu 矩阵和数组 finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!