| MATLAB® | ![]() |
After loading a shared library into the MATLAB® workspace, use the calllib function to call functions in the library. Specify the library name, function name, and any arguments that get passed to the function:
calllib('libname', 'funcname', arg1, ..., argN)The following example calls functions from the libmx library to test the value stored in y. To load the library, type:
hfile = [matlabroot '\extern\include\matrix.h'];
loadlibrary('libmx', hfile)
To create a variable y, type:
y = rand(4, 7, 2);
To get information about y, type:
calllib('libmx', 'mxGetNumberOfElements', y)
MATLAB displays:
ans =
56
Type:
calllib('libmx', 'mxGetClassID', y)
MATLAB displays:
ans = mxDOUBLE_CLASS
For information on how to define the argument types, see Passing Arguments.
![]() | Getting Information About the Library | Passing Arguments | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |