Main Content

matlab::engine::FutureResult

Retrieve result from asynchronous operation

Description

A future result is an object that you can use to retrieve the result of MATLAB® functions or statements. The FutureResult class provides all member functions of the C++ std::future class.

Class Details

Namespace:

matlab::engine
IncludeMatlabEngine.hpp

Constructor Summary

Create a FutureResult object using these asynchronous functions:

Method Summary

Member Functions

cancel

Cancel the operation held by the FutureResult object.

Member Functions Delegated to std::future

operator=, share, get, 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. You cannot cancel asynchronous operations that use: matlab::engine::startMATLABAsync, matlab::engine::connectMATLABAsync, or matlab::engine::findMATLABAsync.

Parameters

bool allowInterrupt

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

Returns

bool

Was command canceled if execution had already begun.

Example
bool flag = future.cancel();
Exception Safety

No exceptions thrown

Version History

Introduced in R2017b