MATLAB Answers

Jette
0

How can I run Matlab completely quiet?

Asked by Jette
on 12 Nov 2014
Latest activity Commented on by Jette
on 13 Nov 2014
How can I run Matlab completely quiet? I want absolutely NO windows to open at any time.
I call the Matlab script from Perl: $command_string = sprintf("matlab -nosplash -nojvm -nodisplay -nodesktop -minimize -r \"run(\'main.m\'); exit;\""); system($command_string);
It STILL opens a window with the massage “To get started, type one of these: helpwin, helpdesk, or demo. ...“
This gets opened minimized, but it is still a problem. I want it completely quiet. As now I cannot use the computer while the script runs. If for instance I am writing and the Matlab script is executed the icons in the desktop toolbar blink and cursor goes to the newly opened (but minimized) window. That means that what I type just disappears.
What I want is Matlab to execute the script without opening any windows AT ALL. Is that possible?

  1 Comment

Jette
on 13 Nov 2014
I searched for the answer on the net for hours yesterday. The question has been up on stackoverflow a number of times, and it seems the answer is that it isn't possible in Window: You cannot run Matlab silent in Windows! Sounds crazy (or maybe like a bug). I have rewritten my script, so now it always runs and waits for a file to exists. This file is created by my Perl script at the point where I had the system call for Matlab. Sigh.
If it is possible to run Matlab silent in Windows, please tell me how. I would still like to know.

Sign in to comment.

3 Answers

Answer by Titus Edelhofer on 13 Nov 2014
 Accepted Answer

Hi Jette,
I'm pretty sure there is no way to do this with MATLAB only. If you happen to have the MATLAB compiler you could use the compiler to create an executable. This would not open anything ...
Titus

  0 Comments

Sign in to comment.


Answer by Andreas Goser on 13 Nov 2014

I would like discussing this from the angle of why this is important for you. From your description, I would expect MATLAB opens and then you need to minimize it once and can work with other tools. But your description also suggest you cannot type e.g. an email.
A couple of questions:
  • Can it be you are running / starting MATLAB very often with this workflow?
  • Is this multiple instances on your local machines?
  • Why perl? Is there something you cannot do within MATLAB?
  • Would you benefit from remote Access on a different machine or a Cluster?

  1 Comment

Jette
on 13 Nov 2014
  • Item one Can it be you are running / starting MATLAB very often with this workflow?
Yes exactly.
  • Item one Is this multiple instances on your local machines?
No just one. It did the job and then existed. Then a few minutes or seconds later it started again.
  • Item one Why perl? Is there something you cannot do within MATLAB?
Yes.
  • Item one Would you benefit from remote Access on a different machine or a Cluster?
That would be overkill.

Sign in to comment.


Answer by Friedrich
on 13 Nov 2014

Hi all.
It is possible using WMIC on Windows, e.g. through VBS. Short and easy:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = 12 'HIDDEN_WINDOW
Set objProcess = GetObject( _
"winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create( _
"""C:\Program Files\MATLAB\R2014b\bin\win64\matlab.exe"" -nosplash -nodesktop -r ""fid=fopen('C:\test.txt','w');fclose(fid);quit force""", null, objConfig, intProcessID)
You only need to adjust the path to MATLAB on your machine. For some reason you still need nosplash and nodesktop (I guess MATLABs window initialisation happens after Windows hooks in to hide everything. So a few windows slip through.)

  1 Comment

Jette
on 13 Nov 2014
Sounds like quite a work around. I will think of it next time I have the problem. Thanks.

Sign in to comment.