Main Content


Wait for model execution to complete

Since R2023b



wait(statusObj,timeOut) gets the wait status for an SLDRT.RunStatus object. If the wait function is called during real-time simulation, MATLAB® waits until execution stops or the timeOut period expires, and the output indicates whether the execution stops within the specified timeOut. If the wait function is called when execution is not running, the function immediately returns without waiting for the timeOut period to expire.


collapse all

This example shows how to use the wait function to check whether a running real-time executable stops within the specified timeout.

Open the model. Set the stop time. Create the SLDRT.RunStatus object. Use the wait function to check whether execution ended within the specified timeout.

myRunStatus ='sldrtex_counter',Wait="off");
checkTimeOut = wait(myRunStatus,25)
checkTimeOut =



Input Arguments

collapse all

The SLDRT.RunStatus object provides simulation run status and provides access to data from scopes and logged signals after the simulation run completes.

Example: wait(myRunStatus,25)

The timeout period for the wait check in seconds, specified as a positive integer.

Example: wait(myRunStatus,25)

Version History

Introduced in R2023b