| General Rules for Passing Arguments There are some important things to note about the input and output arguments shown in the function listing of the previous section: • Many of the arguments (like int32, double) are very similar to their C counterparts. In these cases, you need only to pass in the MATLAB types shown for these arguments. • Some arguments in C (like **double, or predefined structures), are quite different from standard MATLAB types. In these cases, you usually have the option of either passing a standard MATLAB type and letting MATLAB convert it for you, or converting the data yourself using MATLAB functions like libstruct and libpointer. See the next section on "Data Conversion" on page 2-15. • C input arguments are often passed by reference. Although MATLAB does not support passing by reference, you can create MATLAB arguments that are compatible with C references. In the listing shown above, these are the arguments with names ending in Ptr and PtrPtr.See"Creating References" on page 2-26. • C functions often return data in input arguments passed by reference. MATLAB creates additional output arguments to return these values. Note that in the listing in the previous section, all input arguments ending in Ptr or PtrPtr arealsolistedasoutputs. |