如何隐藏"MATLAB命令窗口"当我从命令行运行m文件时?

如何隐藏

问题描述:

我正在使用这样的命令行字符串运行MATLAB:

I am running MATLAB with a command line string like this:

C:\<a long path here>\matlab.exe -nodisplay -nosplash -nodesktop -r "run('C:\<a long path here>\mfile.m');"

m文件包含plot()函数,用于在x-y平面上绘制简单曲线.

The m-file contains a plot() function to plot a simple curve on the x-y plane.

m文件成功运行并使用我在上面指定的命令行字符串绘制绘图.但是,每次我运行此命令时,都会在绘图中显示一个名为"MATLAB Command Window"的窗口.

The m-file successfully runs and draws the plotting with the command line string I specified above. However, every time I run this command, a window named "MATLAB Command Window" appears along with the plotting.

如何使此"MATLAB命令窗口"不出现,以便仅显示绘图.

How do I make this "MATLAB Command Window" NOT appear, so that only the plotting will be visible.

"MATLAB命令窗口"如下所示:

The "MATLAB Command Window" looks like below:

运行:

matlab -automation -wait -r "cd \'...\';..."

,它将在用户会话中显示一个最小化的窗口.根据Amro的建议,我们可以将最小化的窗口发送到本地的winlogin会话,这样我们甚至看不到最小化的窗口:

,which will show a minimized Window in the user session. By suggestion from Amro, we can send the minimized window to winlogin session locally so that we even cannot see the minimized Window:

psexec /i 0 matlab -nodesktop -wait -r "plot(rand(100,1)); print -dpng out.png;quit" >null 2>&1

,它将以静默方式将图形保存到C:\ Windows \ System32(如果启用了ISD服务,则可能会弹出一个交互式服务检测对话框窗口,并且/s或/x选项在Windows Server 2003或2008中不起作用)

,which will save the figure to C:\Windows\System32 silently (if ISD service is enabled it may pop up an interactive services detection dialog window, and /s or /x option do not work in Windows server 2003 or 2008.)