I want to do this without loops:
% A ~ 4x2x3; B ~ 4x3x2; C ~ 4x2x2;
for i=1:4
C(i,:,:) = squeeze(A(i,:,:))*squeeze(B(i,:,:));
end
Thanks!
I want to do this without loops:
% A ~ 4x2x3; B ~ 4x3x2; C ~ 4x2x2;
for i=1:4
C(i,:,:) = squeeze(A(i,:,:))*squeeze(B(i,:,:));
end
Thanks!
Haven't benchmarked this (so this is not guaranteed to be faster), but here goes:
Note that you might also run into memory problems if
A
andB
are large (in which case you'll have to resort to loops).