如何在 Windows 平台上禁用 JVM 以运行后台 matlab 脚本 [英] How can I disable the JVM on a Windows platform for running background matlab scripts

查看:26
本文介绍了如何在 Windows 平台上禁用 JVM 以运行后台 matlab 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里发现了一个类似的问题,但对我没有帮助,所以我问自己的问题.我有一个 matlab 脚本,可以在 linux 下使用 nohup 命令完美运行.不幸的是,我也需要在 Windows 上运行它.但我不明白为什么我的命令仍然不起作用.我的脚本做了一个特定的循环,但在第一个循环之后它停止给我一个关于 java 或其他东西的错误.我必须告诉你,如果我不放 -nodisplay 命令,在 linux 下也会出现同样的问题.

我的批处理线如下

matlab -nodisplay -automation -r "run('myfile.m')" -logfile output.txt -minimize

请帮帮我.

我想我发现了我的问题,问题是当我在 linux 下使用 -nodisplay 时,命令 usejava('awt') 可以工作,因为我的 java 环境被禁用,但这并没有发生在窗户下!为什么?

第二次修改:我想我找到了与我需要的非常相似的东西.

matlab -noawt -noFigureWindows -r "run('myfile.m')" -logfile output.txt -minimize

分析运行,什么也没说,但 MATLAB 命令窗口仍以最小化打开..uhm我宁愿有任何东西可以打开!

我必须添加另一件事..nohup 永远不会等待并继续前进,直到它到达脚本的末尾,但是如果有的话,使用任何其他批处理命令,例如 start是任何输入请求还是等待"它会停止,直到有人提供输入!

解决方案

未记录的 -noawt 选项将阻止 GUI 功能,但让 Java 运行.正如您所发现的,将其与 -noFigureWindows 结合起来,您应该拥有所需的东西.或者,您可以 命令行工具如下,

nircmd.exe exec hide win64MATLAB.exe -noawt -noFigureWindows -nosplash -minimize ...

我认为应该这样做,但是确保您在 bin<architecture> 文件夹中启动实际的 MATLAB.exe,而不仅仅是 binmatlab.exe,因为当它启动实际的 MATLAB.exe 时,它​​不会被隐藏.

I found a similar question here that doesn't help me so I'm asking my own. I have a matlab script that perfectly works under linux with nohup command. Unfortunately, I need to run that on windows also. But I can't understand why my command still doesn't work. My script does a certain loop but after the first it stops giving me an error about the java or something. I must tell you that the same problem occur under linux if I don't put the -nodisplay command.

My batch line is the following

matlab -nodisplay -automation -r "run('myfile.m')" -logfile output.txt -minimize

Please help me.

edit: I think I found my issue the problem is when I use -nodisplay under linux the command usejava('awt') works because my java environment is disabled, however this does not happen under windows! Why?

second edit: I think I found something that is quite similar to what I needed.

matlab -noawt -noFigureWindows -r "run('myfile.m')" -logfile output.txt -minimize

The analysis runs, without saying nothing, but the MATLAB command window still opens minimized..uhm I'd rather having anything to open up!

I must add another thing..nohup never waits and go forward until it reaches the end of the script, nevertheless using any other batch command such as start if there is any input request or "wait" it stops until someone gives an input!

解决方案

The undocumented -noawt option will prevent the GUI functionality, but let Java run. Combine that with -noFigureWindows, as you discovered, and you should have what you need. Alternatively, you can turn off figure display via your M file with set(0,'DefaultFigureVisible','off').

To see if Java actually loaded, run ver or version -java. Here's what I see with -nojvm.

Then, using Windows' start /b /min MATLAB.exe ... should launch it minimized and without holding a command window opened.

To make MATLAB invisible try using the tiny NirCmd command line tool as follows,

nircmd.exe exec hide win64MATLAB.exe -noawt -noFigureWindows -nosplash -minimize ...

I think that should do it, but make sure you start the actual MATLAB.exe in the bin<architecture> folder, not just binmatlab.exe because when it launches the actual MATLAB.exe, it will not be hidden.

这篇关于如何在 Windows 平台上禁用 JVM 以运行后台 matlab 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆