Main Content

matlab::engine::SharedFutureResult

Retrieve result from asynchronous operation as shared future

Description

A shared future result is an object that you use to retrieve the result of MATLAB® functions or statements any number of times.

Class Details

Namespace:

matlab::engine
IncludeMatlabEngine.hpp

Constructor Summary

Create a FutureResult object using one of these asynchronous functions:

Method Summary

Member Functions

cancel

Cancel the operation held by the FutureResult object.

Member Function Delegated to std::shared_future

operator=, get, valid, wait, wait_for, wait_until

Exceptions Thrown by get Method

matlab::engine::EngineException

Cannot start or connect to MATLAB session.

matlab::engine::CancelException

Execution of command is canceled.

matlab::engine::InterruptedException

Evaluation of command is interrupted.

matlab::engine::MATLABNotAvailableException

The MATLAB session is not available.

matlab::engine::MATLABSyntaxException

There is a syntax error in the MATLAB function.

matlab::engine::MATLABExecutionException

MATLAB run-time error in the function.

matlab::engine::TypeConversionException

The result from a MATLAB function cannot be converted to the specified type.

Method Details

cancel

bool FutureResult::cancel(bool allowInterrupt = true);
Description

Cancel the evaluation of the MATLAB function or statement.

Note that you cannot cancel asynchronous start, connection, or find operations, which are initiated using these functions: matlab::engine::startMATLABAsync, matlab::engine::connectMATLABAsync, or matlab::engine::findMATLABAsync.

Parameters

bool allowInterrupt

If false, do not interrupt if execution has already begun.

Return Value

bool

True if the MATLAB command can be canceled

Examples
bool flag = future.cancel();
Exceptions

None

Version History

Introduced in R2017b