Why does my MATLAB function that calls "isempty" on a struct not match the corresponding C++ code generated with MATLAB Coder?
Mostrar comentarios más antiguos
I am generating C++ code from a MATLAB algorithm using MATLAB Coder in MATLAB R2024b, and when I reference the numerical outputs of the original algorithm and the generated code against each other, I observe the C++ results do not match the original implementation.
On inspecting the generated code, I see that part of the algorithm is missing in the C++ code. In my MATLAB implementation, there is an if-else statement conditioned on "if isEmpty(x)", where "x" is a struct. However, in the C++ code, only the else branch is generated.
The type of the struct "x" is included in the "args" option for the "codegen" command, and "x" is initialized as "{}" in both the MATLAB and C++ implementations.
Why does the generated code not match the original?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Simulink Coder en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!