Better Loop Structure to Execute Faster

조회 수: 1 (최근 30일)
Hokkien
Hokkien 2021년 4월 28일
댓글: Hokkien 2021년 4월 28일
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.

채택된 답변

Walter Roberson
Walter Roberson 2021년 4월 28일
A = B./C * 1000;
no loop.
  댓글 수: 1
Hokkien
Hokkien 2021년 4월 28일
Thank you.
Do you mean that I can write in this form:
A = B./(C*0.001);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by