Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Code Optimization problem and profiler question

1 visualización (últimos 30 días)
Gregory Vigil
Gregory Vigil el 18 de Oct. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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.

Respuestas (0)

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by