How can I run Matlab completely quiet?

22 次查看(过去 30 天)
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 个评论
Jette
Jette 2014-11-13
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.

请先登录,再进行评论。

采纳的回答

Titus Edelhofer
Titus Edelhofer 2014-11-13
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

更多回答(2 个)

Friedrich
Friedrich 2014-11-13
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 个评论
Jette
Jette 2014-11-13
Sounds like quite a work around. I will think of it next time I have the problem. Thanks.

请先登录,再进行评论。


Andreas Goser
Andreas Goser 2014-11-13
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 个评论
Jette
Jette 2014-11-13
  • 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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by