File Exchange

image thumbnail

Managing Deployed Application Output with Message Handlers

version (2.81 KB) by Peter Webb
Example code for "Managing Deployed Application Output with Message Handlers".

1 Download

Updated 01 Sep 2016

View Version History

View License

Demonstrates how to redirect the output of a MATLAB-Compiler generated application to a log file.

Cite As

Peter Webb (2021). Managing Deployed Application Output with Message Handlers (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)



thanks for this submission.

It works just fine for a command line application. However for a GUI application I can't suppress the command window compiling with log.c.

Can you please advice what needs to be changed in log.c (and possibly also in the mbuild-command?) to suppress the command window for Windows GUI applications?

Thank you


Peter Webb


The MATLAB Compiler generates libmsgfcn.h and libmsgfcn.lib. And yes, this will be a topic for a future blog post (to be published in Sept. or Oct. 2011, most likely).


Hi Peter,

This looks like a very interesting way to redirect the output streams in deployed applications, however, the ZIP file available for download does not appear to include the libmsgfcn.lib and libmsgfcn.h files. Could you advise me where to locate these files please.

Your example here seems to relate to output redirection when calling the shared libary from a standalone C application - is it possible to achieve a similar effect when calling the shared library from a .NET applicatation? I am are running in to problems when the compiled Matlab code tries to output text to the console (i.e. standard output stream) which causes the .NET application to throw an exception.

The only advise I have been able to find online for redirecting streams is to use evalc() in the compiled code, however, this is not very elegant.

Do you have any plans to elaborate on this important subject in one of your excellent blog posts?



MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!