These tables show how MATLAB® data types correspond to fixed-width C++ types.
C Fixed-Width Integer Type | Equivalent MATLAB Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This table shows how MATLAB data types correspond to std::vector
types. By default,
MATLAB represents std::vector
types with the MATLAB
clib.array
type. For more information, see MATLAB Object For C++ Arrays.
C++ std::vector<T> Type | Equivalent MATLAB
|
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
C Floating Point Type | Equivalent MATLAB Type |
---|---|
|
|
|
|
C++ std::vector<T> Floating Point Type | Equivalent MATLAB
|
---|---|
|
|
|
|
Other C Type | Equivalent MATLAB Type |
---|---|
|
|
Other C++ std::vector<T> Type | Equivalent MATLAB
|
---|---|
|
|
MATLAB supports these non-fixed-width C integer types. Based on the compiler used, MATLAB maps these types to the corresponding fixed-width C types, as shown in the Fixed-Width Data Types tables.
short
short int
signed short
signed short int
unsigned short
unsigned short int
int
signed int
unsigned
unsigned int
long
signed long
signed long int
unsigned long
unsigned long int
long long
These tables show how MATLAB converts string
and char
data returned
from C++ into MATLAB types.
C++ Character Type | Equivalent MATLAB Type |
---|---|
|
|
|
|
|
|
|
|
C++ String Type | Equivalent MATLAB Type |
---|---|
|
|
|
|
|
|
const char * Character and String Types | Equivalent MATLAB Type |
---|---|
| Same as
|
| scalar |
C++ Exact-Width Character Type | Equivalent MATLAB Type |
---|---|
|
|
|
|
These tables show how to call a C++ user-defined type in a MATLAB interface library libname
.
C++ User-Defined Type | Equivalent MATLAB Type |
---|---|
|
|
|
|
C++ Class Type | Equivalent MATLAB
|
---|---|
|
|
|
|
|
|
nullptr
Argument Typesnullptr
Input Argument TypesMATLAB provides a clib.type.nullptr
type so that you can pass
NULL to a function with these C++ input argument types:
Pointers to objects. However, pointers to fundamental MATLAB array types are not supported.
shared_ptr
Arrays
The clib.type.nullptr
type is supported for these MATLAB argument
types:
scalar object pointers
clib
arrays
nullptr
Return TypesThe C++ interface returns type-specific empty
values for functions
that return nullptr
.
For type double
, MATLAB returns []
for the value
double.empty
.
For all other fundamental types, MATLAB returns an
value. To determine MLTYPE
.emptyMLTYPE
, look for the C or C++ type in
the tables in this topic. MLTYPE
is in the
Equivalent MATLAB Type column.
To test for nullptr
types, call the isempty
function.
For non-fundamental types, MATLAB returns a nullptr
object. To test for
nullptr
objects, call the clibIsNull
function.
If the data type of an argument/return type in a class constructor, method, or function is one of these types, or if the library contains any unsupported language features, then the functionality is not included in the MATLAB interface to the library.
Any type with a size greater than 64 bits, for example long double
void *
Arrays of character types (wchar_t
, char16_t
, char32_t
)
Pointers or arrays of std::string
References to a pointer in a function
Pointers or references to enumerations
Reference data members
std
smart pointers other than std::shared_ptr
Static data members
**
pointers to primitive types, such as double**
. MATLAB supports **
pointers to custom classes used as function or method parameter types.
Multilevel pointers, such as type
***
Function pointer
Class templates with incomplete or no instantiations
union
These types defined in the std
namespace are supported. All other types in the std
namespace are not supported.
std::string
, std::wstring
, std::u16string
, std::u32string
std::vector
std::shared_ptr
MATLAB reports on constructs that use unsupported types. To view these messages,
use the 'Verbose'
option in the clibgen.generateLibraryDefinition
or clibgen.buildInterface
functions.
For example, suppose that functionName
in
ClassName
is defined in HeaderFile.h
. If an
argument to functionName
is of unsupported type
type
, then MATLAB does not add functionName
to the definition file. In
addition, if 'Verbose'
is true
, then
clibgen.generateLibraryDefinition
displays this message.
Did not add member 'functionName' to class 'ClassName' at HeaderFile.h:290. 'type' is not a supported type.
clibgen.buildInterface
| clibgen.generateLibraryDefinition