Help with matlab C eval function
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
I am trying to pass a pointer structure and normal variables using C eval. Matlab throws error, cannot parse variables to uint8 from double. I am not sure where this type casting is happening. Any help is appreciated.
uint8_t checkcurrentk(float ILout, ila* obj) // C function
Vout=(coder.ceval('checkcurrent',IA,coder.ref(ila)));
typdef struct s_AIndCurr
{
float ILa1
float ILa2
float ILS3
float ILScal
} Ilas
extern Ilas ila;
댓글 수: 0
답변 (1개)
Satwik
2024년 2월 16일
Ensure that the function name you use in “coder.ceval” matches the actual function name. In the code you provided, the C function is named “checkcurrentk” and the function call in the “coder.ceval” is “checkcurrent”. This should match unless you have a specific reason for the discrepancy.
Additionally, the error message indicates that you might be passing a “double” to a function that expects a “uint8”. You should check all instances of calling “coder.ceval” and ensure that the types of all arguments match the expected types in the C function declarations.
Addressing these points should resolve the issue. If the issue persists, please provide the complete code to help diagnose the issue further.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!