필터 지우기
필터 지우기

is it possible to replace for loops to fast it up?

조회 수: 2 (최근 30일)
elis02
elis02 2018년 9월 27일
답변: Jan 2018년 9월 27일
Hello,
Example of something i have is:
for ang=1:length(angle)
parfor dist=1:length(distance)
sol(ang,dist)=abs(pulsecompress_new_3620_check([distance(dist) angle(ang)]));
end
end
every alteration in the function takes a long time. I have long arrays for "distance" and "angle" these two "for" loops might take several days. Is it possible to use the matrix nature of matlab to make this code run faster?
Thanks,
  댓글 수: 3
KSSV
KSSV 2018년 9월 27일
We need to check the function pulsecompress_new_3620_check to make it fast.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2018년 9월 27일
Start the optimization of the code by using the profiler to determine the bottleneck. It is a waste of time to improve a piece of code, which takes a negligible amount of the total run time only: If you accelerate a part be a factor 2, which takes 2% of the run time, the total time is reduced by 1% only.
After finding the most time consuming part, post it here together with some relevant inputs, e.g. created by rand() if possible. The typical dimensions matter.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by