Printing outputs when running C code in simulink via the coder.ceval function
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Peter O
am 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 Kommentare
Siehe auch
Kategorien
Mehr zu Configure and View Diagnostics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!