Main Content

MATLAB Performance Improvements

Vector-Based Processing

  • Use vector-based processing. With vector-based processing, the program processes multiple samples during a single execution call to a System object™. Consider using vectors from roughly 366 to several thousand. The default is 3660, which represents 10 Ethernet packets.

  • Use large vectors of data to minimize function call overhead.

MATLAB Code Generation

You can accelerate your MATLAB® algorithms by generating a MEX function using the MATLAB Coder™ function codegen.

Use codegen to generate a MEX function from MATLAB code. The following example generates a MEX file called sdruExMex from the function sdruExample:

codegen sdruExample -args {ones(10,1)} -o sdruExMex -g -launchreport


When you use this function, you must release the radio object before attempting to exit MATLAB, or MATLAB stops responding.

For a full list of syntax options and input parameters, see the codegen (MATLAB Coder) reference page.


sdruExample is used only for illustrative purposes; it is not a function shipped with the support package for USRP™ Radio. You must provide your own function for codegen.

Related Topics