Can I modify how a native Simulink block is auto-coded?
조회 수: 1 (최근 30일)
이전 댓글 표시
My Simulink model uses native Simulink blocks within multiple atomic subsystems that are defined as reusable functions with unique file names. When I auto-code my model, the native Simulink blocks get auto-coded as in-lined functions within the atomic subsystem's auto-generated function file. The problem comes when another atomic subsystem also uses this same native Simulink block, but, this time, the MATLAB Coder placed just a function call out to the code that is now in-lined within the other atomic subsystem's reusable function. This creates a dependency between the two subsystems' functions and the order in which they are compiled. Is there a setting either on the native Simulink block or within the model code generation configuration parameters that will allow me to specifify exactly how I want the native Simulink blocks to be auto-coded. I would like to have them coded as reusable functions within their own uniqe files which can be called by my other code.
댓글 수: 0
채택된 답변
Guy Rouleau
2013년 5월 28일
The Code Replacement Library seems to be what you are looking for. See this example:
추가 답변 (1개)
Valmir Sadiku
2013년 5월 28일
편집: Valmir Sadiku
2013년 5월 28일
One possible way to do that are:
- Right-Click on your subsystem -> select 'Block Parameter (Subsystem)'
- Select 'Treat as atomic unit'
- Go to the 'Code Generation' page and choose the 'Function packaging' as Reusable function.
hopefully this will help you.
참고 항목
카테고리
Help Center 및 File Exchange에서 Subsystems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!