Printing outputs when running C code in simulink via the coder.ceval function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Peter O
il 24 Set 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 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!