This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Handle 8-, 16-, and 32-Bit Data

The MATLAB® API provides a set of functions that support signed and unsigned 8-, 16-, and 32-bit data. For example, the mxCreateNumericArray function constructs an unpopulated N-dimensional numeric array with a specified data size. For more information, see mxClassID.

Once you have created an unpopulated MATLAB array of a specified data type, you can access the data using mxGetData and 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.

The example, doubleelement.c, constructs a 2-by-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:

mex doubleelement.c

Call the example.

ans =
     2     6
     4     8

The output of this function is a 2-by-2 matrix populated with unsigned 16-bit integers.

See Also

| | |

Related Examples

Was this topic helpful?