Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Code Optimization problem and profiler question
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a smoothing algorithm that I'm working on. What is the best way to optimize my code to minimize runtime? This algorithm is running over a series of 3D matrices that are at least 64x64x1000, but could potentially be even larger. I'm wondering what the fastest way to write this code since it's running over such large numbers. I've included the basic algorithm as it currently is below:
windowSize = 5;
for k = 1:numTile
for j = 1:22;
for i = 1:22;
for t = 1:endTime
first = t - windowSize;
if (first < 1)
first = 1;
end
last = t + windowSize;
if (last > endTime)
last = endTime;
end
dataArray{k}(i,j,t) = median(dataArray{k}(i,j,first:last),'omitnan');
end
dataArray{k}(i,j,:) = smooth(dataArray{k}(i,j,:),windowSize,'lowess'
end
end
end
I also have a second question. Is it possible to exlude lines from the profiler? I have several commands that require user input, and I'd prefer to exclude them so that it's easier to tell how the runtime is changing without the variability of human input.
I appreciate any help with this; I've never really optimized code before so this is kind of new territory for me. Thanks.
0 commentaires
Réponses (0)
Cette question est clôturée.
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!