이 페이지는 기계 번역을 사용하여 번역되었습니다. 영어 원문을 보려면 여기를 클릭하십시오.
데이터 복사 횟수 줄이기
생성된 코드에서 데이터 사본을 제거하여 RAM 및 ROM 소비량을 줄이고 코드 실행 속도를 높입니다. 코드 생성기가 일부 데이터의 복사본을 제거합니다. 특정 모델 파라미터 설정을 조정하고, MATLAB 함수 블록의 입력 및 출력 인수에 동일한 이름을 지정하고, Simulink 신호를 사용하여 재사용을 지정하면 다른 데이터 사본을 제거할 수 있습니다.
모델 설정
| 불변 신호 인라인 처리 | 생성된 코드에서 불변 신호의 기호 이름을 변환 |
| 불필요한 지역 변수 줄이기(표현식 폴딩) | 표현식을 하나의 표현식으로 통합하도록 지정합니다. |
| 사용자 함수 간의 함수 인라인 처리 | Control inlining for calls from user-written functions to other user-written functions (R2025a 이후) |
| MathWorks 함수 간의 함수 인라인 처리 | Control inlining for calls from MathWorks functions to other MathWorks functions (R2025a 이후) |
| 사용자 함수와 MathWorks 함수 간의 함수 인라인 처리 | Control inlining for calls from user-written functions to MathWorks functions and from MathWorks functions to user-written functions (R2025a 이후) |
도움말 항목
- Fold Expressions
Expression fold code to minimize the computation of intermediate results at block outputs and the storage of such results in temporary buffers or variables.
- Enable and Reuse Local Block Outputs in Generated Code
Where possible, the code generator declares block outputs as local variables, so that it can potentially reuse these variables.
- Generate Efficient Code for Buses
Model buses to maximize efficiency of the generated code.
- Use memcpy Function to Optimize Generated Code for Vector Assignments
The code generator optimizes the generated code for vector assignments by replacing
forloops withmemcpyfunction calls. - Control Inlining to Fine-Tune Performance and Readability of Generated Code
Inlining eliminates the overhead of function calls but can produce larger C/C++ code and reduce code readability.