Hi, I want to speed up my script with double loop.
조회 수: 5 (최근 30일)
이전 댓글 표시
I would like to eliminate double-loop that script below has.
I have difficulty in vectorizing/optimizing the code handling multi-dimensional arrays.
A is the sz×n matrix and B is the sz×m matrix. sz is the 1×p vector.
Thus, X shall be m×n×p matrix.
Can someone suggest me the
for i = 1:n
for j = 1:m
X(j,i,[1:length(sz)]) = A(:,i)' + B(:,j)';
end
end
I would be happy if some one suggest me solutions.
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!