matlab-mcp-core-server

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MATLAB MCP Core Server

MATLAB MCP Core Server

Skill by ara.so — MCP Skills collection.
The MATLAB MCP Core Server enables AI applications to interact with MATLAB, allowing you to write and execute MATLAB code, perform static code analysis, and manage MATLAB sessions directly from your AI coding assistant.
ara.so提供的Skill — MCP Skills合集。
MATLAB MCP Core Server支持AI应用与MATLAB交互,让你可以直接通过AI代码助手编写并执行MATLAB代码、进行静态代码分析,以及管理MATLAB会话。

What It Does

功能介绍

  • Start and control MATLAB from AI applications (Claude Code, VS Code Copilot, etc.)
  • Execute MATLAB code and scripts, returning output to your AI assistant
  • Analyze MATLAB code for style issues, potential errors, and best practices
  • Detect installed toolboxes and MATLAB version information
  • Connect to existing MATLAB sessions or start new ones
  • Support multiple display modes (desktop or headless)
  • 从AI应用(Claude Code、VS Code Copilot等)启动并控制MATLAB
  • 执行MATLAB代码与脚本,将结果返回至你的AI助手
  • 分析MATLAB代码,检查风格问题、潜在错误及最佳实践
  • 检测已安装工具箱和MATLAB版本信息
  • 连接现有MATLAB会话或启动新会话
  • 支持多种显示模式(桌面模式或无桌面模式)

Installation

安装步骤

Prerequisites

前提条件

  1. Install MATLAB R2021a or later and add it to your system PATH
  2. Download the server binary from releases
  1. 安装MATLAB R2021a或更高版本,并将其添加至系统PATH
  2. 发布页面下载服务器二进制文件

For Claude Code

适用于Claude Code

bash
undefined
bash
undefined

Add the server (replace with your actual binary path)

添加服务器(替换为你的实际二进制文件路径)

claude mcp add --transport stdio matlab -- /path/to/matlab-mcp-core-server
claude mcp add --transport stdio matlab -- /path/to/matlab-mcp-core-server

With custom working folder

指定自定义工作目录

claude mcp add --transport stdio matlab -- /path/to/matlab-mcp-core-server --initial-working-folder=/home/user/myproject
claude mcp add --transport stdio matlab -- /path/to/matlab-mcp-core-server --initial-working-folder=/home/user/myproject

With nodesktop mode

使用无桌面模式

claude mcp add --transport stdio matlab -- /path/to/matlab-mcp-core-server --matlab-display-mode=nodesktop
undefined
claude mcp add --transport stdio matlab -- /path/to/matlab-mcp-core-server --matlab-display-mode=nodesktop
undefined

For VS Code (GitHub Copilot)

适用于VS Code(GitHub Copilot)

Create
.vscode/mcp.json
in your workspace:
json
{
    "servers": {
        "matlab": {
            "type": "stdio",
            "command": "/path/to/matlab-mcp-core-server",
            "args": [
                "--initial-working-folder=/home/user/projects",
                "--matlab-display-mode=nodesktop"
            ]
        }
    }
}
Windows example:
json
{
    "servers": {
        "matlab": {
            "type": "stdio",
            "command": "C:\\Program Files\\matlab-mcp-core-server\\matlab-mcp-core-server-win64.exe",
            "args": [
                "--initial-working-folder=C:\\Users\\username\\projects",
                "--initialize-matlab-on-startup=true"
            ]
        }
    }
}
在工作区创建
.vscode/mcp.json
文件:
json
{
    "servers": {
        "matlab": {
            "type": "stdio",
            "command": "/path/to/matlab-mcp-core-server",
            "args": [
                "--initial-working-folder=/home/user/projects",
                "--matlab-display-mode=nodesktop"
            ]
        }
    }
}
Windows示例:
json
{
    "servers": {
        "matlab": {
            "type": "stdio",
            "command": "C:\\Program Files\\matlab-mcp-core-server\\matlab-mcp-core-server-win64.exe",
            "args": [
                "--initial-working-folder=C:\\Users\\username\\projects",
                "--initialize-matlab-on-startup=true"
            ]
        }
    }
}

For Claude Desktop

适用于Claude Desktop

  1. Download
    matlab-mcp-core-server.mcpb
    from releases
  2. Install Filesystem extension in Claude Desktop
  3. Double-click the
    .mcpb
    file and click Install
  4. Configure via Settings > Extensions > Configure
  1. 从发布页面下载
    matlab-mcp-core-server.mcpb
    文件
  2. 在Claude Desktop中安装Filesystem扩展
  3. 双击
    .mcpb
    文件并点击安装
  4. 通过设置>扩展>配置进行参数设置

Configuration Arguments

配置参数

All arguments can be specified as CLI flags, in your MCP config, or as environment variables (prefix
MW_MCP_SERVER_
, uppercase, underscores).
所有参数可通过CLI标志、MCP配置文件或环境变量(前缀
MW_MCP_SERVER_
,大写,下划线分隔)指定。

Essential Arguments

核心参数

bash
undefined
bash
undefined

Specify MATLAB installation

指定MATLAB安装路径

--matlab-root=/usr/local/MATLAB/R2026a
--matlab-root=/usr/local/MATLAB/R2026a

Environment variable: MW_MCP_SERVER_MATLAB_ROOT

环境变量:MW_MCP_SERVER_MATLAB_ROOT

Set initial working directory

设置初始工作目录

--initial-working-folder=/home/user/myproject
--initial-working-folder=/home/user/myproject

Environment variable: MW_MCP_SERVER_INITIAL_WORKING_FOLDER

环境变量:MW_MCP_SERVER_INITIAL_WORKING_FOLDER

Display mode: desktop or nodesktop

显示模式:desktop或nodesktop

--matlab-display-mode=nodesktop
--matlab-display-mode=nodesktop

Environment variable: MW_MCP_SERVER_MATLAB_DISPLAY_MODE

环境变量:MW_MCP_SERVER_MATLAB_DISPLAY_MODE

Initialize MATLAB immediately on startup

启动时立即初始化MATLAB

--initialize-matlab-on-startup=true
--initialize-matlab-on-startup=true

Environment variable: MW_MCP_SERVER_INITIALIZE_MATLAB_ON_STARTUP

环境变量:MW_MCP_SERVER_INITIALIZE_MATLAB_ON_STARTUP

undefined
undefined

Session Management

会话管理

bash
undefined
bash
undefined

Connect to existing MATLAB session (R2023a+)

连接至现有MATLAB会话(R2023a+)

--matlab-session-mode=existing
--matlab-session-mode=existing

Environment variable: MW_MCP_SERVER_MATLAB_SESSION_MODE

环境变量:MW_MCP_SERVER_MATLAB_SESSION_MODE

Setup for existing session mode (run once)

为现有会话模式进行初始化设置(仅需执行一次)

./matlab-mcp-core-server --setup-matlab
undefined
./matlab-mcp-core-server --setup-matlab
undefined

Advanced Arguments

高级参数

bash
undefined
bash
undefined

Custom tools definition

自定义工具定义

--extension-file=/path/to/my-tools.json
--extension-file=/path/to/my-tools.json

Environment variable: MW_MCP_SERVER_EXTENSION_FILE

环境变量:MW_MCP_SERVER_EXTENSION_FILE

Log configuration

日志配置

--log-folder=/tmp/matlab-mcp-logs --log-level=debug
--log-folder=/tmp/matlab-mcp-logs --log-level=debug

Environment variables: MW_MCP_SERVER_LOG_FOLDER, MW_MCP_SERVER_LOG_LEVEL

环境变量:MW_MCP_SERVER_LOG_FOLDER, MW_MCP_SERVER_LOG_LEVEL

Disable telemetry

禁用遥测

--disable-telemetry=true
--disable-telemetry=true

Environment variable: MW_MCP_SERVER_DISABLE_TELEMETRY

环境变量:MW_MCP_SERVER_DISABLE_TELEMETRY

undefined
undefined

Available Tools

可用工具

1. detect_matlab_toolboxes

1. detect_matlab_toolboxes

Returns information about installed MATLAB version and toolboxes.
Usage in AI conversation:
  • "What MATLAB toolboxes are installed?"
  • "Check my MATLAB version"
  • "List available MATLAB products"
Example response:
MATLAB Version: R2026a
Installed Toolboxes:
- Signal Processing Toolbox (9.3)
- Image Processing Toolbox (12.0)
- Deep Learning Toolbox (24.1)
返回已安装MATLAB版本及工具箱信息。
AI对话中使用示例:
  • "我安装了哪些MATLAB工具箱?"
  • "检查我的MATLAB版本"
  • "列出可用的MATLAB产品"
示例响应:
MATLAB版本:R2026a
已安装工具箱:
- Signal Processing Toolbox (9.3)
- Image Processing Toolbox (12.0)
- Deep Learning Toolbox (24.1)

2. check_matlab_code

2. check_matlab_code

Performs static code analysis without executing the script.
Parameters:
  • script_path
    (string): Absolute path to
    .m
    file
Usage in AI conversation:
  • "Analyze this MATLAB script for issues"
  • "Check my code quality in analysis.m"
  • "What coding style problems are in /home/user/matlab/process_data.m?"
Example:
Script: /home/user/projects/calculate_fft.m

Analysis results:
- Line 15: Variable 'N' is defined but never used
- Line 23: Use of deprecated function 'fft2'. Consider 'fft' instead
- Line 45: Missing semicolon may cause unwanted output
- Performance: Consider preallocating array at line 12
无需执行脚本即可进行静态代码分析。
参数:
  • script_path
    (字符串):
    .m
    文件的绝对路径
AI对话中使用示例:
  • "分析这个MATLAB脚本的问题"
  • "检查analysis.m的代码质量"
  • "/home/user/matlab/process_data.m里有哪些编码风格问题?"
示例:
脚本:/home/user/projects/calculate_fft.m

分析结果:
- 第15行:变量'N'已定义但未使用
- 第23行:使用了已弃用函数'fft2',建议改用'fft'
- 第45行:缺少分号可能导致不必要的输出
- 性能建议:建议在第12行预分配数组

3. evaluate_matlab_code

3. evaluate_matlab_code

Executes MATLAB code string and returns output.
Parameters:
  • code
    (string): MATLAB code to execute
  • project_path
    (string): Working directory for execution
Usage in AI conversation:
  • "Run this MATLAB code:
    x = 1:10; mean(x)
    "
  • "Execute MATLAB:
    plot(sin(0:0.1:2*pi))
    "
  • "Calculate in MATLAB:
    A = magic(5); det(A)
    "
Example code snippets:
Simple calculation:
matlab
x = linspace(0, 2*pi, 100);
y = sin(x);
plot(x, y);
title('Sine Wave');
Matrix operations:
matlab
A = [1 2 3; 4 5 6; 7 8 9];
B = inv(A' * A) * A';
disp('Moore-Penrose pseudoinverse:');
disp(B);
Signal processing:
matlab
fs = 1000;
t = 0:1/fs:1-1/fs;
signal = sin(2*pi*50*t) + 0.5*sin(2*pi*120*t);
fft_result = fft(signal);
power = abs(fft_result).^2/length(signal);
fprintf('Signal power: %.4f\n', sum(power));
执行MATLAB代码字符串并返回输出结果。
参数:
  • code
    (字符串):待执行的MATLAB代码
  • project_path
    (字符串):执行代码的工作目录
AI对话中使用示例:
  • "运行这段MATLAB代码:
    x = 1:10; mean(x)
    "
  • "执行MATLAB代码:
    plot(sin(0:0.1:2*pi))
    "
  • "用MATLAB计算:
    A = magic(5); det(A)
    "
代码示例:
简单计算:
matlab
x = linspace(0, 2*pi, 100);
y = sin(x);
plot(x, y);
title('Sine Wave');
矩阵运算:
matlab
A = [1 2 3; 4 5 6; 7 8 9];
B = inv(A' * A) * A';
disp('Moore-Penrose pseudoinverse:');
disp(B);
信号处理:
matlab
fs = 1000;
t = 0:1/fs:1-1/fs;
signal = sin(2*pi*50*t) + 0.5*sin(2*pi*120*t);
fft_result = fft(signal);
power = abs(fft_result).^2/length(signal);
fprintf('Signal power: %.4f\n', sum(power));

4. run_matlab_file

4. run_matlab_file

Executes a MATLAB script file.
Parameters:
  • script_path
    (string): Absolute path to
    .m
    file
Usage in AI conversation:
  • "Run the MATLAB script at /home/user/analysis.m"
  • "Execute my data processing script"
  • "Run C:\Users\name\projects\simulation.m"
Example script (
process_data.m
):
matlab
% Load and process experimental data
data = load('experiment_results.mat');
temperature = data.temperature;
pressure = data.pressure;

% Remove outliers
temp_clean = rmoutliers(temperature);
press_clean = rmoutliers(pressure);

% Calculate statistics
mean_temp = mean(temp_clean);
std_temp = std(temp_clean);
mean_press = mean(press_clean);

% Create visualization
figure;
subplot(2,1,1);
histogram(temp_clean, 30);
title(sprintf('Temperature Distribution (μ=%.2f, σ=%.2f)', mean_temp, std_temp));
xlabel('Temperature (°C)');

subplot(2,1,2);
scatter(temp_clean, press_clean);
title('Pressure vs Temperature');
xlabel('Temperature (°C)');
ylabel('Pressure (kPa)');

% Save results
results.mean_temperature = mean_temp;
results.mean_pressure = mean_press;
results.correlation = corrcoef(temp_clean, press_clean);
save('processed_results.mat', 'results');

fprintf('Processing complete. Results saved.\n');
执行MATLAB脚本文件。
参数:
  • script_path
    (字符串):
    .m
    文件的绝对路径
AI对话中使用示例:
  • "运行/home/user/analysis.m这个MATLAB脚本"
  • "执行我的数据处理脚本"
  • "运行C:\Users\name\projects\simulation.m"
示例脚本(
process_data.m
):
matlab
% 加载并处理实验数据
data = load('experiment_results.mat');
temperature = data.temperature;
pressure = data.pressure;

% 移除异常值
temp_clean = rmoutliers(temperature);
press_clean = rmoutliers(pressure);

% 计算统计值
mean_temp = mean(temp_clean);
std_temp = std(temp_clean);
mean_press = mean(press_clean);

% 创建可视化图表
figure;
subplot(2,1,1);
histogram(temp_clean, 30);
title(sprintf('Temperature Distribution (μ=%.2f, σ=%.2f)', mean_temp, std_temp));
xlabel('Temperature (°C)');

subplot(2,1,2);
scatter(temp_clean, press_clean);
title('Pressure vs Temperature');
xlabel('Temperature (°C)');
ylabel('Pressure (kPa)');

% 保存结果
results.mean_temperature = mean_temp;
results.mean_pressure = mean_press;
results.correlation = corrcoef(temp_clean, press_clean);
save('processed_results.mat', 'results');

fprintf('Processing complete. Results saved.\n');

Common Patterns

常见使用模式

Interactive Data Analysis

交互式数据分析

AI conversation flow:
User: "Load the data from sensor_readings.csv and plot it"

AI uses: evaluate_matlab_code
Code: 
data = readtable('sensor_readings.csv');
plot(data.Time, data.Value);
xlabel('Time'); ylabel('Sensor Reading');
grid on;
AI对话流程:
用户:"加载sensor_readings.csv中的数据并绘图"

AI调用:evaluate_matlab_code
代码:
data = readtable('sensor_readings.csv');
plot(data.Time, data.Value);
xlabel('Time'); ylabel('Sensor Reading');
grid on;

Code Quality Workflow

代码质量工作流

AI conversation flow:
User: "Check my simulation script for issues before running it"

AI uses: check_matlab_code (script_path: /home/user/simulation.m)
Then: Suggests fixes
Then: evaluate_matlab_code (to run corrected version)
AI对话流程:
用户:"运行我的仿真脚本前先检查是否有问题"

AI调用:check_matlab_code(script_path: /home/user/simulation.m)
然后:提出修复建议
然后:evaluate_matlab_code(运行修正后的版本)

Multi-Step Analysis

多步骤分析

matlab
% Step 1: Load and prepare data
data = readmatrix('measurements.csv');
x = data(:,1);
y = data(:,2);

% Step 2: Fit polynomial model
p = polyfit(x, y, 3);
y_fit = polyval(p, x);

% Step 3: Calculate residuals and R-squared
residuals = y - y_fit;
ss_res = sum(residuals.^2);
ss_tot = sum((y - mean(y)).^2);
r_squared = 1 - (ss_res / ss_tot);

% Step 4: Visualize results
figure;
plot(x, y, 'o', 'DisplayName', 'Data');
hold on;
plot(x, y_fit, '-', 'LineWidth', 2, 'DisplayName', 'Fit');
legend('show');
title(sprintf('Polynomial Fit (R² = %.4f)', r_squared));
matlab
% 步骤1:加载并准备数据
data = readmatrix('measurements.csv');
x = data(:,1);
y = data(:,2);

% 步骤2:拟合多项式模型
p = polyfit(x, y, 3);
y_fit = polyval(p, x);

% 步骤3:计算残差和R平方值
residuals = y - y_fit;
ss_res = sum(residuals.^2);
ss_tot = sum((y - mean(y)).^2);
r_squared = 1 - (ss_res / ss_tot);

% 步骤4:可视化结果
figure;
plot(x, y, 'o', 'DisplayName', 'Data');
hold on;
plot(x, y_fit, '-', 'LineWidth', 2, 'DisplayName', 'Fit');
legend('show');
title(sprintf('Polynomial Fit (R² = %.4f)', r_squared));

Connecting to Existing MATLAB Session

连接至现有MATLAB会话

Setup (one-time):
bash
undefined
初始化设置(仅需一次):
bash
undefined

Install the MCP toolbox in MATLAB

在MATLAB中安装MCP工具箱

./matlab-mcp-core-server --setup-matlab --matlab-root=/usr/local/MATLAB/R2026a

**In running MATLAB session:**
```matlab
% Share this MATLAB session with MCP
shareMATLABSession()
Configure MCP server:
json
{
    "servers": {
        "matlab": {
            "type": "stdio",
            "command": "/path/to/matlab-mcp-core-server",
            "args": ["--matlab-session-mode=existing"]
        }
    }
}
./matlab-mcp-core-server --setup-matlab --matlab-root=/usr/local/MATLAB/R2026a

**在运行中的MATLAB会话中:**
```matlab
% 将此MATLAB会话共享给MCP
shareMATLABSession()
配置MCP服务器:
json
{
    "servers": {
        "matlab": {
            "type": "stdio",
            "command": "/path/to/matlab-mcp-core-server",
            "args": ["--matlab-session-mode=existing"]
        }
    }
}

Troubleshooting

故障排除

MATLAB Not Found

MATLAB未找到

Error: Server cannot locate MATLAB installation
Solution:
bash
undefined
错误: 服务器无法定位MATLAB安装路径
解决方案:
bash
undefined

Explicitly specify MATLAB root

显式指定MATLAB根目录

--matlab-root=/usr/local/MATLAB/R2026a
--matlab-root=/usr/local/MATLAB/R2026a

Or add MATLAB to PATH

或将MATLAB添加至PATH

export PATH="/usr/local/MATLAB/R2026a/bin:$PATH"
undefined
export PATH="/usr/local/MATLAB/R2026a/bin:$PATH"
undefined

Permission Denied on macOS

macOS上权限被拒绝

Error: Cannot execute binary on macOS
Solution:
bash
chmod +x ~/Downloads/matlab-mcp-core-server
错误: 无法在macOS上执行二进制文件
解决方案:
bash
chmod +x ~/Downloads/matlab-mcp-core-server

Graphics Issues in nodesktop Mode

无桌面模式下的图形问题

Problem: Plots don't appear in
nodesktop
mode
Solution: Use
desktop
mode or save figures to files:
matlab
figure;
plot(x, y);
saveas(gcf, 'output.png');
问题:
nodesktop
模式下无法显示绘图
解决方案: 使用
desktop
模式或将图形保存为文件:
matlab
figure;
plot(x, y);
saveas(gcf, 'output.png');

Script Execution Errors

脚本执行错误

Error: "File not found" when running scripts
Solution: Use absolute paths and verify file location:
bash
undefined
错误: 运行脚本时提示“文件未找到”
解决方案: 使用绝对路径并验证文件位置:
bash
undefined

Correct

正确写法

script_path: /home/user/projects/analysis.m
script_path: /home/user/projects/analysis.m

Incorrect (relative paths may fail)

错误写法(相对路径可能失败)

script_path: ../analysis.m
undefined
script_path: ../analysis.m
undefined

Existing Session Not Connecting

无法连接至现有会话

Problem: Server doesn't connect to running MATLAB
Solution:
  1. Verify MATLAB version is R2023a or later
  2. Run
    shareMATLABSession()
    in MATLAB command window
  3. Ensure only one MATLAB session is shared
  4. Check that
    --setup-matlab
    was run successfully
问题: 服务器无法连接至运行中的MATLAB
解决方案:
  1. 确认MATLAB版本为R2023a或更高
  2. 在MATLAB命令窗口中运行
    shareMATLABSession()
  3. 确保仅共享一个MATLAB会话
  4. 确认
    --setup-matlab
    已成功执行

Memory Issues with Large Data

大数据处理时的内存问题

Problem: MATLAB runs out of memory
Solution:
matlab
% Process data in chunks
chunk_size = 1000;
for i = 1:chunk_size:length(data)
    chunk = data(i:min(i+chunk_size-1, end));
    process_chunk(chunk);
end

% Clear variables when done
clear large_array;
问题: MATLAB内存不足
解决方案:
matlab
undefined

Log File Location

分块处理数据

Find logs for debugging:
bash
undefined
chunk_size = 1000; for i = 1:chunk_size:length(data) chunk = data(i:min(i+chunk_size-1, end)); process_chunk(chunk); end

Specify custom log location

处理完成后清除变量

--log-folder=/home/user/matlab-logs --log-level=debug
clear large_array;
undefined

Default locations:

日志文件位置

Linux/macOS: /tmp

Windows: C:\Users\username\AppData\Local\Temp

undefined
查找用于调试的日志:
bash
undefined

Code Analysis False Positives

指定自定义日志位置

Problem:
check_matlab_code
reports valid code as problematic
Note: Static analysis may flag intentional patterns. Use
evaluate_matlab_code
to verify code actually works as intended.
--log-folder=/home/user/matlab-logs --log-level=debug

Environment Variables Reference

默认位置:

Linux/macOS: /tmp

Windows: C:\Users\username\AppData\Local\Temp

bash
undefined
undefined

Core configuration

代码分析误报

export MW_MCP_SERVER_MATLAB_ROOT="/usr/local/MATLAB/R2026a" export MW_MCP_SERVER_INITIAL_WORKING_FOLDER="/home/user/projects" export MW_MCP_SERVER_MATLAB_DISPLAY_MODE="nodesktop" export MW_MCP_SERVER_MATLAB_SESSION_MODE="existing" export MW_MCP_SERVER_INITIALIZE_MATLAB_ON_STARTUP="true"
问题:
check_matlab_code
将有效代码标记为问题代码
说明: 静态分析可能会标记一些有意使用的模式。可使用
evaluate_matlab_code
验证代码实际运行是否符合预期。

Advanced options

环境变量参考

export MW_MCP_SERVER_EXTENSION_FILE="/path/to/tools.json" export MW_MCP_SERVER_LOG_FOLDER="/var/log/matlab-mcp" export MW_MCP_SERVER_LOG_LEVEL="info" export MW_MCP_SERVER_DISABLE_TELEMETRY="true"
undefined
bash
undefined

Best Practices

核心配置

  1. Use absolute paths for all file references
  2. Specify working directories via
    project_path
    or
    initial-working-folder
  3. Check code before running with
    check_matlab_code
    for complex scripts
  4. Use nodesktop mode for production/server environments
  5. Connect to existing sessions when iterating on live data analysis
  6. Save figures to files when working in headless mode
  7. Clear large variables explicitly to manage memory
  8. Use try-catch blocks in scripts to handle errors gracefully
export MW_MCP_SERVER_MATLAB_ROOT="/usr/local/MATLAB/R2026a" export MW_MCP_SERVER_INITIAL_WORKING_FOLDER="/home/user/projects" export MW_MCP_SERVER_MATLAB_DISPLAY_MODE="nodesktop" export MW_MCP_SERVER_MATLAB_SESSION_MODE="existing" export MW_MCP_SERVER_INITIALIZE_MATLAB_ON_STARTUP="true"

高级选项

export MW_MCP_SERVER_EXTENSION_FILE="/path/to/tools.json" export MW_MCP_SERVER_LOG_FOLDER="/var/log/matlab-mcp" export MW_MCP_SERVER_LOG_LEVEL="info" export MW_MCP_SERVER_DISABLE_TELEMETRY="true"
undefined

最佳实践

  1. 所有文件引用使用绝对路径
  2. 通过
    project_path
    initial-working-folder
    指定工作目录
  3. 对于复杂脚本,运行前先用
    check_matlab_code
    检查代码
  4. 在生产/服务器环境中使用无桌面模式
  5. 处理实时数据分析时连接至现有会话
  6. 在无头模式下工作时将图形保存为文件
  7. 显式清除大型变量以管理内存
  8. 在脚本中使用try-catch块优雅处理错误