Unit Delay Initialization C Code Generation
조회 수: 10 (최근 30일)
이전 댓글 표시
I have a model in which I am generating C code for. This model has a Unit Delay block in with an intial condition set to 0. When I generate the C code, where the intialization step would usually occur for a non zero Initial condition, No code is generated but I assume somewhere it must be intialising this variable. Where is this done instead and why does it change.
Thanks
댓글 수: 0
답변 (1개)
Fangjun Jiang
2024년 3월 18일
이동: Fangjun Jiang
2024년 3월 28일
You could experiment. Set the initial value to be zero and non-zero to see where the code is located. Note that in C code, the initial value for a variable is zero by default. Or it can be initialized when the variable is declared, such as
int myNum = 15;
댓글 수: 8
Fangjun Jiang
2024년 3월 18일
이동: Fangjun Jiang
2024년 3월 28일
no. There should be a generated C code variable that corresponds to the output of the Unit Delay block. Search the declaration of that variable in the C code. You can turn on traceability to help find it.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!