How to generate bool type identifier 'true' and 'false' C code
이전 댓글 표시
I got some Simulink.Parameter with data type boolean in Simulink model, and i m tring to generate C code with Code generater. But everytime i got code such as:
const Boolean_T c_flag = 1;
// or
const Boolean_T c_flag = 0;
however what i want is things like :
const Boolean_T c_flag = true;
// or
const Boolean_T c_flag = false;
// or
const Boolean_T c_flag = Boolean(1);
// or
const Boolean_T c_flag = Boolean(0);
i have tried to set the parameter value to '1', 'true', '=true' or even '=boolean(1)',but nothing works.
is that possible in Code Generater/
답변 (2개)
madhan ravi
2023년 12월 22일
0 개 추천

댓글 수: 4
madhan ravi
2023년 12월 22일
According to my understanding from Embedded coder documentation it can be only either 1 or 0 values.
dongshan wang
2023년 12월 22일
madhan ravi
2023년 12월 22일
Could you show what you have tried and the generated code?
dongshan wang
2023년 12월 25일
Brandon Stevens
2024년 8월 6일
0 개 추천
Please see the documentation page below for instructions on how to do this in Embedded Coder under the section titled "Boolean Identifiers"
카테고리
도움말 센터 및 File Exchange에서 Simulink Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!