How to put print statements in MEX files generated with codegen?

I have a matlab function that I'm compiling into a MEX with codegen. I want to have some print statements in there, mostly because the thing is slowing to a crawl and I want to see where time is being spent. I can't figure out how to get things to print out right away. As it is, if I just leave semicolons off, the values all print at once after execution is complete. How can I make something print out right away?
I found another similar question to this, but couldn't make sense of the answer.

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 10월 19일

0 개 추천

Perhaps if you flush the stdout at regular intervals, you will see the displayed statements immediately. You could try using coder.ceval to call fflush(stdout); or use the MATLAB equivalent, which according to this discussion is drawnow('update').

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품

태그

질문:

2012년 10월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by