フィルターのクリア

Does not using 'clc' command increase the computation time?

1 回表示 (過去 30 日間)
Çağatay Murat Yılmaz
Çağatay Murat Yılmaz 2020 年 10 月 15 日
コメント済み: Ameer Hamza 2020 年 10 月 19 日
Hello, I am running a code that test different parameters performance on an algorithm and I write results to command line as below. However the program starts fast but than begin to slower and slower nearly after 30000 steps. Normally it does samething, and there is no workload that comes from different parameter. Dou you know what can cause such problems? Thank you.
A part of code:
for mi=1:length(matris_size)
for gi=[2 3 4]
gauss_f=f_gauss_dagilimi(gauss(gi).n, gauss(gi).sigma, gauss(gi).window_size);
for peak_threshold=[0.01 : 0.2: 1.41 ]
for en_buyuk_kac_deger=[1:15:91]
for min_value=[0.05 : 0.10: 0.45 ]
for kanal_indis=kanallar
%algorithm
end
end
end
end
end
end
a sample output:
22000 -> subject [ 1]: 1 2 4 1 2 0.01 31 0.25 --45.00 -0.15
22001 -> subject [ 1]: 1 2 5 1 2 0.01 31 0.25 --65.00 0.26
22002 -> subject [ 1]: 1 2 6 1 2 0.01 31 0.25 --55.00 0.06
22003 -> subject [ 1]: 1 2 7 1 2 0.01 31 0.25 --60.00 0.12
22004 -> subject [ 1]: 1 2 8 1 2 0.01 31 0.25 --45.00 -0.17
22005 -> subject [ 1]: 1 2 9 1 2 0.01 31 0.25 --40.00 -0.29
22006 -> subject [ 1]: 1 2 10 1 2 0.01 31 0.25 --55.00 0.02
22007 -> subject [ 1]: 1 2 11 1 2 0.01 31 0.25 --50.00 -0.08
22008 -> subject [ 1]: 1 2 12 1 2 0.01 31 0.25 --60.00 0.14
22009 -> subject [ 1]: 1 2 13 1 2 0.01 31 0.25 --45.00 -0.17

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 10 月 15 日
Not using clc does not slow down your code. The display in command does not have a direct relation with the execution speed of your code. At least not enough to have a significant impact on your execution speed. One of the main reasons why execution speed becomes significantly slower is if you are expanding your arrays dynamically. Are you pre-allocating your arrays?
  2 件のコメント
Çağatay Murat Yılmaz
Çağatay Murat Yılmaz 2020 年 10 月 19 日
Dear Hamza, thank you very much for your answer. As you mentioned, it does not have a direct relation with printing values in command line. I had stored the paramater values in a dynamical "validasyon_sonuc" value. I have understand that it grows continuosly and creates a performance issue. I have pre-allocated my matrices and stored them on hard drive for futuru uses and the problem have solved.
validasyon_sonuc=[validasyon_sonuc; kanal_indis mi gi peak_threshold en_buyuk_kac_deger min_value acc kk];
Ameer Hamza
Ameer Hamza 2020 年 10 月 19 日
I am glad to be of help!!! :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by