Printing outputs when running C code in simulink via the coder.ceval function
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi
I am running some C code in simulink via the coder.ceval. The code is somewhat complex, and originally printed outputs to a seperate file via writef, and error messages via fprintf. How would i go about printing the fprintf messages to some sort of consol when running it in simulink? It doesnt have to be a consol per say, but having some sort of message to the user for troubleshooting is neccisary.
0 commentaires
Réponses (1)
Peter O
le 24 Sep 2020
Not completely sure about this one, but if there is there a way to access the Simulink diagnostics panel from within the C code, that might be a nice place to put it:
If there's a way to pass in the function pointer reference to sldiagviewer.reportInfo(Message), you might be able to do that, but I don't know if Simulink is designed to handle external calls to that function. (I wouldn't bet on it working.) If you're able to wait for the C function to return to display the message, then you could probably make a field in the cfunc's return variable (or in one of its pass-by-ref arguments) that holds the diagnostics info/codes/messages, and use a little MATLAB glue code after it returns to call reportInfo().
0 commentaires
Voir également
Catégories
En savoir plus sur Configure and View Diagnostics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!