Alternative for a for loop. How would I write this code without using a for loop to save some computation time?
이전 댓글 표시
% % % Lamd is a [4096 X 46080] matrix
for x=1:64
Image=volume(:,:,x);
Img=Lamd'*Image(:);
end
댓글 수: 5
madhan ravi
2019년 3월 6일
편집: madhan ravi
2019년 3월 6일
size(volume) ?
KSSV
2019년 3월 6일
How about Image?
madhan ravi
2019년 3월 6일
It’s pretty clear that Image is of size 4096X1 because matrix multiplication is carried out
Viktor
2019년 3월 6일
KSSV
2019년 3월 6일
@madhan ravi...yes it is pretty clear ....after making it image(:). I mean to ask dimensions of image before converting it into a column.
답변 (1개)
KSSV
2019년 3월 6일
0 개 추천
Read about MTLAB element by element opeartions...I guess .* should work in your case. Also have a look on arrayfun
댓글 수: 1
madhan ravi
2019년 3월 6일
? arrayfun() has internal loops and is slower than an explicit loop
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!