Make async Requests Using mexCallMATLAB - MATLAB & Simulink (original) (raw)
Main Content
Be aware of the behavior when calling back into MATLABĀ® using mexCallMATLAB
with an async
request like matlab::engine::MATLABEngine::fevalAsync
. ThemexCallMATLAB
function is synchronous. After it launches a function using the call to fevalAsync
, the MEX function continues to the end, returns to MATLAB, and is then unloaded. If the async
processing of the requested feval
command tries to reference the MEX function, it generates an exception.
Consider using the mexLock
and mexUnLock
functions to ensure that the MEX function stays in memory while theasync
function processes.