How can I write to either the MATLAB Command Window or the Simulink Diagnostic Viewer from code called by a C Function block?
Show older comments
I have a C Function Block that calls a C wrapper of a long C++ method defined in an external file. I would like to periodically write messages from that C++ code and have the messages appear at runtime either in the MATLAB command window or the Simulink Diagnostic Viewer. I have tried redirecting stdout with
if (AllocConsole() == 0) {
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
}
But I still see nothing from either std::cout or fprintf calls. Any help would be appriciated!
Accepted Answer
More Answers (0)
Categories
Find more on Configure and View Diagnostics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

