Running a MATLAB Function and MATLAB Executable File (mex) in Soft Real-Time
First, run the function ScheduleEticMatlabExample which prints to the MATLAB Command Window every 0.5 seconds. This function uses etic and etoc to schedule the printing.
Then, run the script buildMatlabSoftRealTimeExample which generates a mex file from ScheduleEticMatlabExample. Since etic and etoc are supported for code generation, the generated mex file ScheduleMatlabExample_mex prints to the MATLAB Command Window every 0.5 seconds.
Running the function directly in MATLAB and running the mex version of it both results in Soft Real-Time execution.