フィルターのクリア

how can i find out how many time my for runs?

2 ビュー (過去 30 日間)
HADIMARGO
HADIMARGO 2021 年 6 月 27 日
コメント済み: HADIMARGO 2021 年 6 月 27 日
so i have a code.
i put it in a for loop to repeat it 10.000 Times!
I want to know how many times it has been repeated?
how could i found this?

採用された回答

Image Analyst
Image Analyst 2021 年 6 月 27 日
Try this
startTime = tic;
loopCounter = 1;
for k = 1 : 10
% Some code which may cause the loop to break early....
if iNeedToQuitEarlyCondition
% Something happened where we no longer want to do all 10 iterations.
break;
end
% Increment how many times the loop actually finished:
loopCounter = loopCounter + 1;
end
fprintf('The loop executed %d times in %d seconds.\n', loopCounter, toc(startTime));

その他の回答 (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