File Exchange

image thumbnail

Managing Deployed Application Output with Message Handlers

version (2.81 KB) by

Example code for "Managing Deployed Application Output with Message Handlers".



View License

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

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

Peter Webb (view profile)


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).


Russ (view profile)

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?




Updated license

MATLAB Release
MATLAB 7.2 (R2006a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video