Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Set Up C/C++ Examples

The Matrix Library provides a full set of routines that handle the types supported by MATLAB®. For each data type, there is a specific set of functions that you can use for data manipulation. The first example discusses the simple case of doubling a scalar. After that, the examples discuss how to pass in, manipulate, and pass back various data types, and how to handle multiple inputs and outputs. Finally, the sections discuss passing and manipulating various MATLAB types.

Source code for the examples in this section is in the matlabroot/extern/examples/refbook folder. To build an example, first copy the file to a writable folder, such as c:\work, on your path:

copyfile(fullfile(matlabroot,'extern','examples','refbook',...
  'filename.c'), fullfile('c:','work'));

where filename is the name of the example.

At the MATLAB command prompt, type:

mex filename.c

The following topics look at source code for the examples. Unless otherwise specified, the term "MEX-file" refers to a source file.

For a list of MEX example files available with MATLAB, see Table of MEX-File Source Code Files.

Was this topic helpful?