Alternative for a for loop. How would I write this code without using a for loop to save some computation time?
Afficher commentaires plus anciens
% % % Lamd is a [4096 X 46080] matrix
for x=1:64
Image=volume(:,:,x);
Img=Lamd'*Image(:);
end
5 commentaires
madhan ravi
le 6 Mar 2019
Modifié(e) : madhan ravi
le 6 Mar 2019
size(volume) ?
KSSV
le 6 Mar 2019
How about Image?
madhan ravi
le 6 Mar 2019
It’s pretty clear that Image is of size 4096X1 because matrix multiplication is carried out
Viktor
le 6 Mar 2019
KSSV
le 6 Mar 2019
@madhan ravi...yes it is pretty clear ....after making it image(:). I mean to ask dimensions of image before converting it into a column.
Réponses (1)
KSSV
le 6 Mar 2019
0 votes
Read about MTLAB element by element opeartions...I guess .* should work in your case. Also have a look on arrayfun
1 commentaire
madhan ravi
le 6 Mar 2019
? arrayfun() has internal loops and is slower than an explicit loop
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!