Pass Fixed-Sized Array Parameter
If the parameter is a fixed-sized array, then the number of dimensions and the type of the elements of a passed array must match those of the expected parameter.
Display Help for Interface
Suppose that you have an interface with the definition for function
fcn
. To run this example, follow the instructions in Build Interface for Fixed-Sized Array Example to
generate a MATLAB® interface named libFixedSized
.
When you display help for libFixedSized
, you see it contains a
function fcn
that takes a three element vector
clib.array.libFixedSized.Double
.
help clib.libFixedSized
Functions contained in clib.libFixedSized: fcn - clib.libFixedSized.fcn Representation of C++ function fcn.
help clib.libFixedSized.fcn
fcn - clib.libFixedSized.fcn Representation of C++ function fcn. clib.libFixedSized.fcn(arr) Input Arguments arr 3 element vector clib.array.libFixedSized.Double
Call Function in MATLAB
Create a clib array of three elements of type
clib.array.libFixedSized.Double
.
arr3 = clibArray("clib.libFixedSized.Double",3);
Call fcn
.
clib.libFixedSized.fcn(arr3);
Build Interface for Fixed-Sized Array Example
This C++ header file defines a function that takes a fixed-sized array of type
double
as input. The size of the array is three.
void fcn(double arr[3]);
To run the example, save this code in a header file named
FixedSized.hpp
, then generate a MATLAB interface named libFixedSized
following the
instructions for creating an interface to a C++ library define by a Header-Only HPP File.
Library Artifacts | MATLAB Interface libname | MATLAB Help |
---|---|---|
Header file
|
|
|