Printing outputs when running C code in simulink via the coder.ceval function

조회 수: 2 (최근 30일)
John Doe
John Doe 2020년 9월 23일
답변: Peter O 2020년 9월 24일
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.

답변 (1개)

Peter O
Peter O 2020년 9월 24일
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().

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by