Azzera filtri
Azzera filtri

My code takes so long to execute

1 visualizzazione (ultimi 30 giorni)
Muhamed Sewidan
Muhamed Sewidan il 3 Feb 2021
Commentato: Image Analyst il 5 Feb 2021
My code works fine until it gets to this block. This loop takes too long to execute. Is there any way to solve this problem?
if ~exist('nworkers','var'), nworkers = 0; end % default nworkers to zero
r1 = rad(1);
parfor (i = 1 : numel( kru ), nworkers)
jlu(:,i) = sbesselj ( lkr, kru(i) );
djlu(:,i) = dsbesselj ( l, kru(i) );
if ru(i) > r1
hlu(:,i) = sbesselh ( lkr, kru(i) );
dhlu(:,i) = dsbesselh ( l, kru(i) );
end
end
  2 Commenti
per isakson
per isakson il 3 Feb 2021
Did you use Preallocation for jlu, djlu, hlu, etc.?
Image Analyst
Image Analyst il 5 Feb 2021
How long is "long"?

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by