Documentation

This is machine translation

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

setdatatype

Class: lib.pointer
Package: lib

Initialize type and size of lib.pointer object

Syntax

setdatatype(h,type,size)

Description

setdatatype(h,type,size) sets data type, type, of size, to lib.pointer, h.

Input Arguments

expand all

lib.pointer object, specified as a handle.

Data type, specified as a character vector.

Size, specified as a vector of double.

Examples

expand all

Load the shrlibsample library.

if ~libisloaded('shrlibsample')
  addpath(fullfile(matlabroot,'extern','examples','shrlib'))
  loadlibrary('shrlibsample')
end

The multDoubleRef function takes a scalar value specified as doubleptr. Create variable xp as a lib.pointer object, and call the function.

xp = libpointer('doublePtr',99);
[xobj,xval] = calllib('shrlibsample','multDoubleRef',xp);

To use the variable xobj, set its size and data type.

setdatatype(xobj,'doublePtr',1,1)
xobj.Value
ans =

   495

Was this topic helpful?