Why does my MATLAB function that calls "isempty" on a struct not match the corresponding C++ code generated with MATLAB Coder?
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Simulink Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!