Main Content

Aufrufen von MATLAB aus Java heraus

Verfassen von Java®-Programmen, die mit MATLAB® funktionieren

Rufen Sie MATLAB-Funktionen auf und evaluieren Sie MATLAB-Anweisungen aus Java-Programmen (synchron oder asynchron). Java-Programme können Daten an den MATLAB-Workspace weiterleiten und von dort abrufen. Die Engine unterstütztJava-Anwendungen, die mit JDK™ entwickelt wurden. Versionsinformationen finden Sie unter MATLAB-Schnittstellen zu anderen Sprachen.

Informationen zum Aufrufen von Java-Funktionen aus MATLAB heraus finden Sie unter Aufrufen von Java aus MATLAB heraus.

Funktionen

alle erweitern

matlab.engine.shareEngineConvert running MATLAB session to shared session
matlab.engine.engineNameReturn name of shared MATLAB session
matlab.engine.isEngineSharedDetermine if MATLAB session is shared

Klassen

alle erweitern

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 (Seit R2021a)

Themen

Erste Schritte

Überblick über die Java-Engine-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.

Verwenden der MATLAB-Engine-API für Java

Spezielle MATLAB-Typen für Java

Fehlersuche

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.