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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by