c++ - how can I make a mex function printf while it's running? -


There is a max file in my MATLAB script, it may take a while to run Max Function, so my code is "without To prevent "any remaining output", I put too many printf statements in the Max file, which produces some running information about the data being processed.

But when I call the Max function, it does not do anything like printf and it remains there while the int is running. Finally, after the completion of your work, this printf all the info I would like - it's not going to be, but after finishing This is not what I need.

So I want to know how to not only make it printf , but whenever I want it printf it.

Yes, mexPrintf is what you need but note that the command window The buffer does not flush with force to use it, often it's too late before your message is printed. This happens if you start heavy computation after calling mexPrintf . After each call for

  mexEvalString ("outow;")  

mexPrintf

If you think that unappealing, you can create a macro which makes both calls:

  #define printfFnc (...) {mexPrintf (__VA_ARGS__) ; MexEvalString ("delo;");}   

This diversified macro uses __VA_ARGS __ . It can not be a part of the standard, but it appears in GCC and Visual C ++ just call printfFnc like you printf (or mexPrintf ).

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -