What things can I do to increase the speed and memory performance of my MATLAB code?
조회 수: 42 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2013년 9월 11일
편집: MathWorks Support Team
2022년 10월 14일
I would like to increase the speed of execution of my MATLAB code.
채택된 답변
MathWorks Support Team
2022년 10월 14일
편집: MathWorks Support Team
2022년 10월 14일
The following provides information on tools within MATLAB that can help you optimize the performance of your code.
1. The first step is to analyze the performance of your MATLAB code in its current state. The following is a link to the documentation regarding this topic:
In particular, the MATLAB Profiler measures where a program spends time and generates a summary. By using the Profiler, you can determine which commands and which lines of code are taking the longest to execute, and therefore determine where you can focus most of your optimization efforts. To read about how to use the MATLAB Profiler to improve performance, please see the following link:
2. There is a section in the documentation that discusses best practices for writing highly efficient code, including when and how to vectorize, how to preallocate memory for arrays,
3. Multithreading comes default enabled in the most recent version of MATLAB. Common mathematical operations are programmed to make use of multithreading. For a list of the affected functions, see the Related Solution at the bottom of this page.
To find out if the Parallel Computing Toolbox can help make best use of a multiple core desktop or a computing cluster, navigate to the following link:
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Debugging and Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!