从Java调用MATLAB时,如何隐藏它的命令窗口? [英] How can I suppress MATLAB's command window when calling it from Java?
问题描述
我正在用Java调用MATLAB,但我想隐藏MATLAB的命令窗口,以使用户感到我只使用了一个Java程序.
I am calling MATLAB with Java but I want to suppress the command window of MATLAB to make users feel that I use only one program which is Java.
此外,我了解了一些称为MATLAB的独立可执行文件,但没有用;对我有帮助吗?
In addition I read about something called standalone executable for MATLAB, but it didn't work; will that help me?
推荐答案
查看 Matlab引擎.该引擎在后台运行(没有GUI或可见的命令行),您可以从代码中调用它.不幸的是,这些示例在C和Fortran中,而不是Java中.我曾经使用过Python,但是我不记得详细信息了.
Check out the Matlab Engine. The engine runs in the background (without a GUI or visible command-line) and you call it from your code. The examples are in C and Fortran, not Java, unfortunately. I got it working with Python once but I don't recall the details.
另请参见:使用引擎的2种方法Java .
ETA:(Windows)命令行上的'matlab -r"statement"'将在Matlab中执行"statement".我的Python黑客将我的Matlab代码放在.m文件中,并将我的数据放入.m文件引用的文本文件中,然后将"matlab -r myFile.m"发送到Windows命令行.请参见 matlab Windows命令.同样,这种方式也没有适用于Matlab的可见GUI.
ETA: 'matlab -r "statement"' on the (Windows) command line will execute "statement" in Matlab. My Python hack was putting my Matlab code in a .m file and my data into a text file referenced by the .m file then sending 'matlab -r myFile.m' to the Windows command line. See the matlab Windows command. Again, there's no visible GUI for Matlab this way.
这篇关于从Java调用MATLAB时,如何隐藏它的命令窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!