matlab.engine.FutureResult.cancelled - Cancellation status of asynchronous call to MATLAB function
from Python - MATLAB (original) (raw)
Main Content
Class: matlab.engine.FutureResult
Namespace: matlab.engine
Cancellation status of asynchronous call to MATLAB function from Python
Syntax
tf = FutureResult.cancelled()
Description
[tf](#bukhoxd-tf) = FutureResult.cancelled()
returns the cancellation status of a call to a MATLAB® function called asynchronously from Python®. FutureResult.cancelled
returns True
if a previous call to FutureResult.cancel
succeeded, and False
otherwise.
Output Arguments
Cancellation status of an asynchronous function call, returned as either True
or False
.
Examples
Start an endless loop in MATLAB with an asynchronous call to the eval
function. Cancel it and check that the engine stopped the loop.
import matlab.engine
eng = matlab.engine.start_matlab()
ret = eng.eval("while 1; end",nargout=0,background=True)
eval_stop = ret.cancel()
tf = ret.cancelled()
print(tf)