The MATLAB® API provides a set of functions that support signed and unsigned 8-, 16-,
and 32-bit data. For example, the
constructs an unpopulated N-dimensional numeric array with a specified data size. For
more information, see
Once you have created an unpopulated MATLAB array of a specified data type, you can access the data using
mxGetImagData. These two
functions return pointers to the real and imaginary data. You can perform arithmetic on
data of 8-, 16-, or 32-bit precision in MEX files and return the result to MATLAB, which recognizes the correct data class.
doubleelement.c, constructs a
2 matrix with unsigned 16-bit integers,
doubles each element, and returns both matrices to MATLAB.
To build this example, at the command prompt type:
Call the example.
ans = 2 6 4 8
The output of this function is a
populated with unsigned 16-bit integers.