matlab.engine.FutureResult class

Package: matlab.engine

Results of asynchronous call to MATLAB function stored in Python object

Description

The FutureResult class stores results of an asynchronous call to a MATLAB® function in a Python® object.

Construction

The MATLAB Engine for Python creates a FutureResult object when a MATLAB function is called asynchronously. There is no need to call matlab.engine.FutureResult() to create FutureResult objects of your own.

Methods

cancelCancel asynchronous call to MATLAB function from Python
cancelledCancellation status of asynchronous call to MATLAB function from Python
doneCompletion status of asynchronous call to MATLAB function from Python
resultResult of asynchronous call to MATLAB function from Python

Exceptions

CancelledError

MATLAB engine cannot cancel function call

InterruptedError

Function call interrupted

MatlabExecutionError

Function call fails to execute

RejectedExecutionError

Engine terminated

SyntaxError

Syntax error in function call

TimeoutError

Result cannot be returned within the timeout period

TypeError

Data type of output argument not supported

Examples

expand all

Call the MATLAB sqrt function from Python. Set async to True to make the function call asynchronously.

import matlab.engine
eng = matlab.engine.start_matlab()
future = eng.sqrt(4.0,async=True)
ret = future.result()
print(ret)
2.0

Related Examples

Introduced in R2014b

Was this topic helpful?