Main Content

MATLAB Runtime User Data Interface

This feature provides a lightweight interface for accessing MATLAB® Runtime data. It allows data to be shared between a MATLAB Runtime instance, the MATLAB code running on that MATLAB Runtime, and the wrapper code that created the MATLAB Runtime. Through calls to the MATLAB Runtime User Data interface API, you access MATLAB Runtime data through creation of a per-instance associative array of mxArrays, consisting of a mapping from string keys to mxArray values. Reasons for doing this include, but are not limited to:

  • You need to supply run-time information to a client running an application created with the Parallel Computing Toolbox™. Profile information may be supplied on a per-execution basis. For example, two instances of the same application may run simultaneously with different profiles.

  • You want to initialize the MATLAB Runtime with constant values that can be accessed by all your MATLAB applications

  • You want to set up a global workspace — a global variable or variables that MATLAB and your client can access

  • You want to store the state of any variable or group of variables

MATLAB Compiler SDK™ software supports per-run-time instance state access through an object-oriented API. Access to a per-run-time instance state is optional, rather than on by default. You can access this state by adding setmcruserdata.m and getmcruserdata.m to your deployment project or by specifying them on the command line. Alternatively, you use a helper function to call these methods as demonstrated in Supply Run-Time Profile Information for Parallel Computing Toolbox Applications.

For more information, see Using the MATLAB Runtime User Data Interface