Main Content

本页的翻译已过时。点击此处可查看最新英文版本。

Java 调用 MATLAB

编写可用于 MATLAB® 的 Java® 程序

以同步或异步方式从 Java 程序调用 MATLAB 函数和计算 MATLAB 语句。Java 程序可以将数据传递到 MATLAB 基础工作区,也可以从工作区获取数据。该引擎支持用 JDK™ 编译的 Java 应用程序。有关版本信息,请参阅其他语言的 MATLAB 接口

要从 MATLAB 调用 Java 函数,请参阅MATLAB 中的 Java 库

函数

全部展开

matlab.engine.shareEngine将正在运行的 MATLAB 会话转换为共享会话
matlab.engine.engineName返回共享 MATLAB 会话的名称
matlab.engine.isEngineShared确定 MATLAB 会话是否共享

全部展开

com.mathworks.engine.MatlabEngineJava class using MATLAB as a computational engine
com.mathworks.matlab.types.ComplexJava class to pass complex data to and from MATLAB
com.mathworks.matlab.types.StructJava class to pass MATLAB struct to and from MATLAB
com.mathworks.matlab.types.CellStrJava class to represent MATLAB cell array of char vectors
com.mathworks.matlab.types.HandleObjectAbstract Java class to represent MATLAB handle objects
com.mathworks.matlab.types.ValueObjectAbstract Java class to represent MATLAB value objects

主题

快速入门

Java 引擎 API 概述

  • Java Engine API Summary
    Here is a summary of the classes and methods available to use the MATLAB Engine API for Java.
  • Java Data Type Conversions
    The MATLAB engine API provides mappings to pass Java data types to MATLAB and pass MATLAB data types to Java, including Java classes to accommodate MATLAB handle objects, cellstrs, structures, and complex arrays.

使用针对 MATLABJava 引擎 API

针对 Java 的专用 MATLAB 类型

Java 使用 MATLAB 功能

疑难解答

MATLAB Engine API Exceptions

The MATLAB Engine API for Java defines specific exception classes for MATLAB.

Pass Java Array Arguments to MATLAB

MATLAB and Java display multidimensional arrays differently, but indexed references to array elements produce the same results.

Incorrect Number of Output Arguments

If you are calling a MATLAB function with no or more than one output argument, you must provide that number in calls to the engine feval method.

Incorrect Java Data Types

In certain cases, you must convert to specific MATLAB types to support the requirements of the MATLAB function you are calling.