Info
此问题已关闭。 请重新打开它进行编辑或回答。
Code Optimization problem and profiler question
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
此问题已关闭。
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!