Main Content

matlab::data::ArrayType

C++ array type enumeration class

Description

Use ArrayType objects to identify the data type and other attributes of a MATLAB® array.

Class Details

Namespace:

matlab::data

Include:

ArrayType.hpp

Enumeration

enum class ArrayType {
    UNKNOWN,
    LOGICAL,
    CHAR,
    DOUBLE,
    SINGLE,
    INT8,
    UINT8,
    INT16,
    UINT16,
    INT32,
    UINT32,
    INT64,
    UINT64,
    COMPLEX_DOUBLE,
    COMPLEX_SINGLE,
    COMPLEX_INT8,
    COMPLEX_UINT8,
    COMPLEX_INT16,
    COMPLEX_UINT16,
    COMPLEX_INT32,
    COMPLEX_UINT32,
    COMPLEX_INT64,
    COMPLEX_UINT64,
    CELL,
    STRUCT,
    VALUE_OBJECT,
    HANDLE_OBJECT_REF,
    ENUM,
    SPARSE_LOGICAL,
    SPARSE_DOUBLE,
    SPARSE_COMPLEX_DOUBLE,
    MATLAB_STRING
};

C++ Data Type Conversion

MATLAB ArrayType Value

C++ TypeDescription
DOUBLE

double

double-precision (64-bit), floating-point number

SINGLE

float

single-precision (32-bit), floating-point number

INT8

int8_t

signed 8-bit integer

UINT8

uint8_t

unsigned 8-bit integer

INT16

int16_t

signed 16-bit integer

UINT16

uint16_t

unsigned 16-bit integer

INT32

int32_t

signed 32-bit integer

UINT32

uint32_t

unsigned 32-bit integer

INT64

int64_t

signed 64-bit integer

UINT64

uint64_t

unsigned 64-bit integer

CHAR

char16_t

16-bit character

LOGICAL

bool

logical

COMPLEX_DOUBLE

std::complex<double>

complex, double-precision (64-bit), floating-point number

COMPLEX_SINGLE

std::complex<float>

complex, single precision (32-bit), floating-point number

COMPLEX_INT8

std::complex<int8_t>

complex, signed 8-bit integer

COMPLEX_UINT8

std::complex<uint8_t>

complex, unsigned 8-bit integer

COMPLEX_INT16

std::complex<int16_t>

complex, signed 16-bit integer

COMPLEX_UINT16

std::complex<uint16_t>

complex, unsigned 16-bit integer

COMPLEX_INT32

std::complex<int32_t>

complex, signed 32-bit integer

COMPLEX_UINT32

std::complex<uint32_t>

complex, unsigned 32-bit integer

COMPLEX_INT64

std::complex<int64_t>

complex, signed 64-bit integer

COMPLEX_UINT64

std::complex<uint64_t>

complex, unsigned 64-bit integer

CELL

matlab::data::Array

Array containing other Arrays

STRUCT

matlab::data::Struct

Array with named fields that can contain data of varying types and sizes

VALUE_OBJECT

matlab::data::Object

MATLAB value object

HANDLE_OBJECT_REF

matlab::data::Object

Reference to an existing handle object in MATLAB

ENUM

matlab::data::Enumeration

Array of enumeration values

SPARSE_LOGICAL

bool

Sparse array of logical

SPARSE_DOUBLE

double

Sparse array of double

SPARSE_COMPLEX_DOUBLE

std::complex<double>

Sparse array of complex double

MATLAB_STRING

matlab::data::MATLABString

MATLAB string

Examples

Test Array for COMPLEX_DOUBLE Type

Suppose that you have an array declared as follows.

matlab::data::TypedArray<double> const argArray

After you set values for argArray, call the sqrt function.

matlab::data::Array const tresults = matlabPtr->feval(u"sqrt", argArray);

These statements test the result for type COMPLEX_DOUBLE and then set the array type.

matlab::data::TypedArray<std::complex<double>> results = factory.createEmptyArray(); 
matlab::data::ArrayType type = tresults.getType(); 
if (type == matlab::data::ArrayType::COMPLEX_DOUBLE) 
    results = (matlab::data::TypedArray<std::complex<double>>) tresults; 
else 
    std::cout << "ERROR: complex double array expected." << std::endl;

Version History

Introduced in R2017b