Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

lib.pointer class

Package: lib

Pointer object compatible with C pointer

Description

MATLAB® automatically converts arguments passed by reference to a function in an external library. Use a pointer object instead of automatic conversion in the following situations.

  • The function modifies data in an input argument.

  • You are passing large amounts of data, and you want to control when MATLAB makes copies of the data.

  • The library stores and uses the pointer, so you want the MATLAB function to control the lifetime of the lib.pointer object.

Construction

To create a lib.pointer object, use the MATLAB libpointer function.

A library function can return a lib.pointer object. Use the setdatatype method to convert the argument manually to use in MATLAB.

Properties

DataType

Type of pointer, specified as a character vector, of any MATLAB numeric type, structure defined in the library, or enumeration defined in the library. For a list of valid MATLAB numeric types, refer to these tables in C and MATLAB Equivalent Types.

  • MATLAB Primitive Types

  • MATLAB Extended Types

Value

Value, specified as any valid value for given type.

Methods

dispDisplay lib.pointer type
isNullPoints to NULL pointer
plus+ (plus) operator for pointer arithmetic
reshapeReshape lib.pointer array
setdatatypeInitialize type and size of lib.pointer object

Definitions

A passed-by-reference argument in the function signature has type names ending with Ptr or PtrPtr.

Examples

expand all

Create a pointer pv of type int16 initialized to 485.

pv = libpointer('int16Ptr',485);

Display the properties of pv.

get(pv)
       Value: 485
    DataType: 'int16Ptr'

See Also

More About

Introduced before R2006a

Was this topic helpful?