Main Content

cancel

Class: matlab.engine.FutureResult
Package: matlab.engine

Cancel asynchronous call to MATLAB function from Python

Syntax

tf = FutureResult.cancel()

Description

tf = FutureResult.cancel() cancels a call to a MATLAB® function called asynchronously from Python®. FutureResult.cancel returns True if it successfully cancels the function, and False if it cannot cancel the function.

Output Arguments

expand all

Cancellation status, returned as either True or False. The status, tf, is True if FutureResult.cancel successfully cancels the asynchronous function call, and is False otherwise.

Examples

expand all

Start an endless loop in MATLAB with an asynchronous call to the eval function. Then, cancel it.

import matlab.engine
eng = matlab.engine.start_matlab()
ret = eng.eval("while 1; end",nargout=0,async=True)
tf = ret.cancel()
print(tf)
True