matlab.engine.FutureResult.cancel - Cancel asynchronous call to MATLAB function from Python - MATLAB (original) (raw)
Main Content
Class: matlab.engine.FutureResult
Namespace: matlab.engine
Cancel asynchronous call to MATLAB function from Python
Syntax
tf = FutureResult.cancel()
Description
[tf](#bukhmuj-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
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
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,background=True)
tf = ret.cancel()
print(tf)