How can I run Matlab completely quiet?

조회 수: 28 (최근 30일)
Jette
Jette 2014년 11월 12일
댓글: Jette 2014년 11월 13일
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