Does not using 'clc' command increase the computation time?
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!