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 Kommentare

size(volume) ?
It’s pretty clear that Image is of size 4096X1 because matrix multiplication is carried out
Volume is [64 x 64 x 64] matrix
@madhan ravi...yes it is pretty clear ....after making it image(:). I mean to ask dimensions of image before converting it into a column.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Read about MTLAB element by element opeartions...I guess .* should work in your case. Also have a look on arrayfun

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 6 Mär. 2019

Kommentiert:

am 6 Mär. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by