|
转的
https://linuxinfo.physik.hu-berlin.de/matlab.html
From the command line:
matlab | graphical interface | matlab -nodesktop -nosplash | text mode, with graphics window | matlab -nodisplay | text mode, without graphics | (if /usr/global/matlab/bin is in PATH).
Running Matlab from scriptsIn order to run Matlab code from a script, prepare a file with extension .m and run it with the switch "-r".
Examples: matlab -r myscript # run myscript.m matlab -r "myfct(2,3)" # run myfct.m with argumentsIn non-interactive mode (e.g. from a batch script), you may have to extend PATH and set MATLABPATH first. In addition, the graphical interface and plot window are to be suppressed.
Example: PATH=/usr/global/matlab/binPATH MATLABPATH=$HOME/my_matlab_dir export MATLABPATH matlab -nodisplay -r "myscript, quit" # run myscript.m and quitThe trailing "quit" makes sure that Matlab is terminated, even if this was omitted from the script.
Plots are generated as usual, but will not be displayed. The most recent one can be stored as a file by a Matlab statement like saveas(gcf,'filename.ext') % format according to extension saveas(gcf,'filename.eps','psc2') % EPS with colorValid extensions are .fig (Matlab's format), .eps, .jpg, .png and others (but no PDF).
|
|