问题
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:
- Use remote desktop to connect to the server and run MATLAB there
- If the server is UNIX, you could run an X server on your laptop (there's a free one with cygwin)
- 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