Search code examples
matlabmatlab-deploymentmatlab-compiler

How can I hide the cmd console from my Matlab Exe?


I've a problem with my EXE file, generated by Matlab Development tool. Pratically, even choosing "Windows StandAlone Mode", when I run the EXE, always appears the hated black CMD console.

How can I avoid this apparition?

Thanks for the help to everyone who Try...


Solution

  • There is a utility published on the Mathworks website that does just that. http://www.mathworks.com/matlabcentral/fileexchange/3909-suppress-command-window

    Another solution would be to use another application to launch your MATLAB exe silently.

    In C# for example you could start your MATLAB exe with the following arguments to hide the console window:

    var process = new Process();
    process.StartInfo.FileName = "path to your exe"
    process.StartInfo.CreateNoWindow = true;
    process.StartInfo.UseShellExecute = false;
    process.StartInfo.RedirectStandardOutput = true;
    
    // ...
    
    process.Start();