3D vectorization, removing for-loop

1 回表示 (過去 30 日間)
Minh Lam
Minh Lam 2019 年 2 月 8 日
I have to use for-loop for each slice of the 3D matrix to perform 2D multiplication.
Is there any other way to remove the for-loop while producing the same result (matrix c, in the below example)?
Purpose of this: for faster performance.
N=12;
a=1:N;
a=reshape(a,2,2,N/4);
b = a+1;
c = zeros(size(b));
for i=1:N/4
c(:,:,i) = a(:,:,i)*b(:,:,i);
end
Thank you!

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by