Llamar a MATLAB desde Java
Llame a funciones de MATLAB y evalúe instrucciones de MATLAB desde programas de Java de forma sincrónica o asincrónica. Los programas de Java pueden pasar datos hacia el área de trabajo de MATLAB y obtener datos desde ella. El motor admite aplicaciones de Java creadas con JDK™. Para obtener más información sobre las versiones, consulte Interfaces de MATLAB a otros lenguajes.
Para llamar a las funciones de Java desde MATLAB, consulte Llamar a Java desde MATLAB.
Funciones
Clases
Temas
Introducción
- MATLAB Engine API for Java
This API enables Java programs to use MATLAB as a computational engine. - Build Java Engine Programs
Set environment variables, Java classpath, and compile and run your Java code. - Java Example Source Code
These examples show how to use the MATLAB Engine API for Java.
Descripción general de 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.
Uso de la API del motor MATLAB para Java
- Start and Close MATLAB Session from Java
Start the Java engine session synchronously or asynchronously and you can pass startup options to MATLAB. - Connect Java to Running MATLAB Session
Connect the Java engine to a running MATLAB session that has been started as or converted to a shared session. - Execute MATLAB Functions from Java
Pass Java variables to MATLAB function calls and return values to Java. - Evaluate MATLAB Statements from Java
Evaluate MATLAB expressions from Java and write variables into the MATLAB base workspace. - Pass Variables from Java to MATLAB
Pass variables from Java to MATLAB as function arguments or by placing those variables in the MATLAB base workspace. - Pass Variables from MATLAB to Java
Get variables from the MATLAB workspace and map them to the appropriate Java type. - Redirect MATLAB Command Window Output to Java
Redirect standard output from the MATLAB command window to Java.
Tipos de MATLAB especializados para Java
- Using Complex Variables in Java
Define complex numbers in Java using theComplex
class. - Using MATLAB Structures in Java
Define MATLAB structure data types in Java using theStruct
class. - Pass Java CellStr to MATLAB
Define a MATLAB cell array of character vectors using the JavaCellStr
class. - Using MATLAB Handle Objects in Java
Return MATLAB handle objects to Java using the JavaHandleObject
class.
Solución de problemas
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.
Número incorrecto de argumentos de salida
Si llama a una función de MATLAB sin argumentos de salida o con más de un argumento de salida, debe proporcionar ese número en llamadas al método feval
del motor.
In certain cases, you must convert to specific MATLAB types to support the requirements of the MATLAB function you are calling.