My code takes so long to execute

3 vues (au cours des 30 derniers jours)
Muhamed Sewidan
Muhamed Sewidan le 3 Fév 2021
Commenté : Image Analyst le 5 Fév 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 commentaires
per isakson
per isakson le 3 Fév 2021
Did you use Preallocation for jlu, djlu, hlu, etc.?
Image Analyst
Image Analyst le 5 Fév 2021
How long is "long"?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Bessel functions dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by