Better Loop Structure to Execute Faster

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 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

質問済み:

2021 年 4 月 28 日

コメント済み:

2021 年 4 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by