zoukankan      html  css  js  c++  java
  • 在命令行下运行Matlab

    2014-04-20 22:08:11

    在命令行下执行:

    matlab -help

    可以得到帮助文件:

    Usage:  matlab [-h|-help] | [-n | -e]
                   [-arch | v=variant | v=arch/variant]
                   [-c licensefile] [-display Xdisplay | -nodisplay]
                   [-nosplash] [-mwvisual visualid] [-debug] [-softwareopengl]
                   [-desktop | -nodesktop | -nojvm]
                   [-r MATLAB_command] [-logfile log]
                   [-Ddebugger [options]]
    
    -h|-help             - Display arguments.
    -n                   - Display final environment variables,
                           arguments, and other diagnostic
                           information. MATLAB is not run.
    -e                   - Display ALL the environment variables and
                           their values to standard output. MATLAB
                           is not run. If the exit status is not
                           0 on return then the variables and values
                           may not be correct.
    -arch                - Start MATLAB assuming architecture arch.
    v=variant            - Start the version of MATLAB found
                           in bin/glnxa64/variant instead of bin/glnxa64.
    v=arch/variant       - Start the version of MATLAB found
                           in bin/arch/variant instead of bin/glnxa64.
    -c licensefile       - Set location of the license file that MATLAB
                           should use.  It can have the form port@host or
                           be a colon separated list of license files.
                           The LM_LICENSE_FILE and MLM_LICENSE_FILE
                           environment variables will be ignored.
    -display Xdisplay    - Send X commands to X server display, Xdisplay.
    -nodisplay           - Do not display any X commands. The MATLAB
                           desktop will not be started. However, unless
                           -nojvm is also provided the Java virtual machine
                           will be started.
    -nosplash            - Do not display the splash screen during startup.
    -mwvisual visualid   - The default X visual to use for figure windows.
    -debug               - Provide debugging information especially for X
                           based problems.
    -desktop             - Allow the MATLAB desktop to be started by a
                           process without a controlling terminal. This is
                           usually a required command line argument when
                           attempting to start MATLAB from a window manager
                           menu or desktop icon.
    -nodesktop           - Do not start the MATLAB desktop. Use the current
                           terminal for commands. The Java virtual machine
                           will be started.
    -singleCompThread    - Limit MATLAB to a single computational thread. 
                           By default, MATLAB makes use of the multithreading 
                           capabilities of the computer on which it is running.
    -nojvm               - Shut off all Java support by not starting the
                           Java virtual machine. In particular the MATLAB
                           desktop will not be started.
    -jdb [port]          - Enable remote Java debugging on port (default 4444)
    -r MATLAB_command    - Start MATLAB and execute the MATLAB_command.
    -logfile log         - Make a copy of any output to the command window
                           in file log. This includes all crash reports.
    -Ddebugger [options] - Start debugger to debug MATLAB.
    -nouserjavapath      - Ignore custom javaclasspath.txt and javalibrarypath.txt files.

    可以看到与图形界面相关的几个参数是:nodisplay, nosplash, nodesktop, nojvm. 它们分别代表什么含义呢?

    1. nodisplay      不显示任何X命令(X server是Linux下的图形引擎,参考:X Window System)。Matlab桌面环境不会启动,但是会启动Java virtual machine除非使用了nojvm参数;
    2. nosplash   程序启动时不显示启动画面(版权页);
    3. nodesktop  不启动桌面环境,在当前终端中执行命令,但是会启动JVM;
    4. nojvm      关闭java支持,不启动JVM,特别的,desktop也不会启动。

    因为Matlab的图形环境依赖JVM,如果不启动JVM,无法执行任何和图形界面相关的命令。若不执行任何X commands,则无法执行imshow()这些函数。所以,我们如果需要在命令行下执行matlab程序,最好只添加:nodesktop nosplash两个参数。

    可以在文件.bashrc中添加:

    alias mrun="matlab -nodesktop -nosplash -logfile `date +%Y_%m_%d-%H_%M_%S`.log -r"

    其中,logfile `date +%Y_%m_%d-%H_%M_%S`.log 将log文件输出在了以程序执行时间为文件名的log文件下。r 参数表示运行matlab命令。

  • 相关阅读:
    WinDbg 查看静态变量
    PLSQL 安装说明
    WinDbg设置托管进程断点
    SQL Server 数据库备份策略,第一周运行失败的原因
    Eclipse开发C/C++ 安装配置图文详解
    C 语言静态链表实现
    C语言结构体,C语言结构体指针,java对象引用,传值,传地址,传引用
    C Primer Plus 收官二叉搜索树实现
    GDB 调试C程序
    C语言 结构体存储空间分配
  • 原文地址:https://www.cnblogs.com/beanocean/p/3677404.html
Copyright © 2011-2022 走看看