Running a MATLAB Function and MATLAB Executable File (mex) in Soft Real-Time

Contents

Running the function directly in MATLAB

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.

Generate a MATLAB Executable (mex) and run

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.

Summary

Running the function directly in MATLAB and running the mex version of it both results in Soft Real-Time execution.