Can I run matlab on Windows with UI, just that the code runs on remote server?

南笙酒味 提交于 2019-12-21 12:12:24

问题


I am using my laptop to run MATLAB and it's very convenient but SLOW. We have strong servers that run MATLAB but it's more convenient for me to run the application with UI on my laptop (as opposed to say running Matlab through command line).

Is it possible to run matlab on Windows, locally, with UI, just that the code runs on a remote server (and thus quicker)?

Thanks!


回答1:


Several options spring to mind, not all of which answer the precise question that you posed. Given that your laptop is Windows, you could do one of these things:

  1. Use remote desktop to connect to the server and run MATLAB there
  2. If the server is UNIX, you could run an X server on your laptop (there's a free one with cygwin)
  3. You could use the Parallel Computing Toolbox and MATLAB Distributed Computing Server to open a matlabpool on the server.

Options (1) and (2) basically mean you're transmitting the MATLAB UI over the wire to your laptop. Option (3) is sort-of most like what you originally asked for, but the matlabpool only runs the body of PARFOR and SPMD blocks on the server.




回答2:


Launching MATLAB on a server without the GUI is covered thoroughly at http://blogs.mathworks.com/desktop/2010/02/22/launching-matlab-without-the-desktop/ you should also read the user comments/discussion there

e.g. you can use

start matlab -nosplash -nodesktop -nojvm -minimize -r "testcommand,quit"

if not using Java is too restrictive for your needs:

Regarding ‘-nodesktop’ vs. ‘-nojvm’, there is a third (undocumented/unsupported) option: ‘-noawt’. -noawt loads Java (thus enabling Java I/O, data structures etc.) and just prevents Java GUI

The discussion there also speaks of using the undocumented com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.hide to hide the command-line window, but that command doesn't seem to work

BTW, instead of launching MATLAB via Windows shell command you could launch as a COM automation server:

http://www.mathworks.com/help/techdoc/matlab_external/brd0v3w.html

or via existing C API for launching MATLAB:

http://www.mathworks.com/help/techdoc/matlab_external/f29148.html

If you use this often (e.g. from a web service), it is best that you keep an instance of MATLAB in memory all the time (since Windows apps for example share code and have separate data this can spare much time by avoiding the reloading of MATLAB code into memory at every script run). That instance could be headless too (with no UI) using this command at server boot (e.g. by adding an entry at HKLM/Software/Microsoft/Windows/CurrentVersion/Run in the Windows registry using "regedit.exe"):

start matlab -nosplash -nodesktop -nojvm -minimize



来源:https://stackoverflow.com/questions/3100251/can-i-run-matlab-on-windows-with-ui-just-that-the-code-runs-on-remote-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!