Using the C++ Math Library | ![]() ![]() |
Using the Print Handler to Print Your Own Messages
The print handler is not reserved for the exclusive use of the MATLAB C++ Math Library. Once you've written a print handler for the library to use, you can also use it to print messages of your own.
You may either call your print handling routine directly, or call the function mwGetPrintHandler()
, which returns a pointer to the current print handling function. The following example function demonstrates how to call mwGetPrintHandler()
and what to do with the result.
#include "matlab.hpp" void hello() { mwOutputFunc f = mwGetPrintHandler(); (*f)("Hello world\n"); }
![]() | Providing Your Own Print Handler | Output to a GUI | ![]() |