Pass Pointers

Pass Primitive MATLAB Type

MATLAB® automatically converts an argument passed by value into an argument passed by reference when the external function prototype defines the argument as a pointer. For example, a MATLAB double argument passed to a function that expects double * is converted to a double pointer by MATLAB.

addDoubleRef is a C function that takes an argument of type double *.

 addDoubleRef C Function

Call the function with three arguments of type double, and MATLAB handles the conversion:

ans =
Was this topic helpful?