Better Loop Structure to Execute Faster

1 visualización (últimos 30 días)
Hokkien
Hokkien el 28 de Abr. de 2021
Comentada: Hokkien el 28 de Abr. de 2021
Hi everyone,
I have a sample loop as below:
tic;
for k=1:3500
for j=1:10000
A(j,k)=B(j,k)/(C(j,1)*0.001);
end
end
toc;
However, this for loop always required 2-3 minutes execution time. Is there any better way to modify this loop in order to shorten the execution time, or it is unavoidable becaused of the large data?
Thank you in advanced.

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Abr. de 2021
A = B./C * 1000;
no loop.
  1 comentario
Hokkien
Hokkien el 28 de Abr. de 2021
Thank you.
Do you mean that I can write in this form:
A = B./(C*0.001);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by