C Function 블록을 사용하여 외부 C/C++ 코드 통합하기
Simulink 모델에서 외부 C/C++ 코드 통합 및 호출
C Function 블록을 사용하면 모델에서 외부 C/C++ 코드를 호출할 수 있습니다. C Function 블록을 사용하면 다음을 수행할 수 있습니다.
데이터를 전처리할 C 코드를 작성하여 C 함수를 호출합니다. 마찬가지로, C 함수를 호출한 후 데이터를 후처리할 C 코드를 작성할 수 있습니다.
시뮬레이션과 코드 생성에 각기 다른 코드를 지정합니다.
외부 코드에 정의된 다수의 C 함수를 호출합니다.
블록에서 캐시된 영속 데이터를 초기화하고 이를 사용합니다.
메모리를 할당 및 할당 해제하거나, 외부 코드 기호를 전처리 및 후처리하거나, 영속 데이터를 초기화 및 종료해야 하는 경우 C Function 블록을 사용하십시오. 단순한 C 코드를 호출하려면 C Caller 블록을 사용하십시오. C 코드를 사용하여 동적 시스템을 Simulink® 모델에 통합하려면 S-Function 블록을 사용하십시오.
블록
C Function | Integrate and call external C/C++ code from a Simulink model |
객체
SymbolSpec | Query and configure C Function block data symbols |
Symbol | C Function block data symbol |
도움말 항목
- Integrate External C/C++ Code into Simulink Using C Function Blocks
Integrate and modify external C Code using C Function blocks.
- Modify States of a C Function Block Using Persistent Symbols
- Change Values of Signals Using C Function Block and Buses
- Access Elements of a Matrix Using Output Code in a C Function Block
- Use External Functions with Matrix Input in a C Function Block
- Define an Alias Type in a C Function Block
- Use Inherited Sizes in a C Function Block
- Use Enumerated Data in a C Function Block
- Interface with C++ Classes Using C Function Block
Use C Function block to interface directly with C++ classes defined in custom code.
- Debug Custom C/C++ Code
Debug custom C/C++ code from within Simulink.