主要内容

CallMATLABJava

Write Java®programs that work with MATLAB®

Call MATLAB functions and evaluate MATLAB statements from Java programs, synchronously or asynchronously. Java programs can pass data to and get data from the MATLAB workspace. The engine supports Java applications built with JDK™.For version information, seeMATLAB Interfaces to Other Languages.

To call Java functions from MATLAB, seeCall Java from MATLAB.

fonctions

développer tout

matlab.engine.shareEngine Convert runningMATLAB会话到共享会话
matlab.engine.engineName Return name of sharedMATLABsession
matlab.engine.isenginehared Determine ifMATLABsession is shared

Classes

développer tout

com.mathworks.engine.MatlabEngine JavaMATLAB作为计算引擎
com.mathworks.matlab.types.Complex Javaclass to pass complex data to and fromMATLAB
com.mathworks.matlab.types.Struct Javaclass to passMATLABstruct向和从MATLAB
com.mathworks.matlab.types.cellstr Javaclass to representMATLABcell array ofchar向量
com.mathworks.matlab.types.HandleObject AbstractJavaclass to representMATLABhandle objects
com.mathworks.matlab.types.ValueObject AbstractJavaclass to representMATLAB值对象

rubriques

开始

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
    MATLAB引擎API提供了将Java数据类型传递给MATLAB并将MATLAB数据类型传递给Java的映射,包括Java类,以容纳MATLAB处理对象,细胞TRSTRS,结构和复杂阵列。

UsingMATLABEngine API forJava

SpecializedMATLAB类型Java

UsingMATLABFeatures fromJava

résolutiondesproblèmes

MATLAB引擎API例外

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 engineFeval方法。

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.