在Linux命令行下运行Matlab
在Linux下安装完matlab后,会在/usr/local/bin/下生成matlab文件,可以使用matlab命令。
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.
在命令行下运行matlab,主要用到上面几个红色的参数。
1.直接运行Matlab
$ matlab
然后可以直接运行matlab脚本
2.运行m文件
如果m文件名为matlabfile.m
(1)方法一
进入m文件所在目录后,运行
$ matlab -nodesktop -nosplash -rmatlabfile
只用文件名matlabfile,不能添加.m
(2)修改.bashrc文件
$ vim ~/.bashrc
添加如下:
# Add an "mrun" alias for running matlab in the terminal.
alias mrun="matlab -nodesktop -nosplash -logfile `date +%Y_%m_%d-%H_%M_%S`.log -r"
保存后,进入.m文件所在目录,运行
$ mrun
matlabfile
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架