Main Content

Display Help for MATLAB Interface to C++ Library

Use these MATLAB® functions to view information about the members of an interface:

  • doc and help — View classes and functions in an interface. When you publish an interface, you can add descriptive text. For more information, see Publish Help Text for MATLAB Interface to C++ Library.

  • methods — View constructor, method, and function names for a class.

  • methods with '-full' option — View constructor, method, and function signatures.

  • methodsview — Table representation of method signatures. You might find the methodsview window easier to use as a reference guide because you do not need to scroll through the Command Window to find information.

Default Argument Help for Functions and Methods

If a C++ function is defined with default arguments, then you can call the function without providing one or more trailing arguments. The function help shows the default value. For example, if the type of arg is double and its default value is 100, then help displays:

clib.libname.funcname(arg)
    Input Arguments
      arg             double = 100

Array Size Help for Functions and Methods

If a function or method takes a clib array or a MATLAB array, the generated help text displays size and type information for the argument. For example, a publisher defines a function with this C++ signature:

unsigned int const * fixedMultiFunc(unsigned int [2][3][4] in)

The help for fixedMultiFunc in library interface demo is:

clib.demo.fixedMultiFunc Representation of C++ function fixedMultiFunc. 
RetVal=clib.demo.fixedMultiFunc(in) 

     Input Arguments 
      in             2x3x4 clib.array.demo.UnsignedInt   

     Output Arguments 
      RetVal         4 element vector read-only clib.array.demo.UnsignedInt

Both in and RetVal arguments are clib arrays of type UnsignedInt. The size of the in array is 2x3x4. The RetVal is a fixed size clib vector with 4 elements. RetVal is also read-only.

The format for the help text for function and method input and output arguments is:

Input/Output Arguments 
  argname   dimension read-only null argtype
  • argname is the argument name.

  • The dimension help text describes the size of the argument. For more information, see the following table.

  • If the array is const, then the help displays the text read-only.

  • If the array is null, then the help displays the text null.

  • The argtype text displays clib.array.libname.type for clib arrays, and mltype for MATLAB arrays, where libname is the interface library name, type is a C++ type, and mltype is a MATLAB type.

dimension Help TextSize Description
n1x...xnN

Fixed size multidimensional clib array for an N dimensional array, where n1,…,nN represents the size for each dimension.

n-D array

Variable size multidimensional clib array.

nxm

Fixed size clib matrix, where n and m represent the number of columns and rows in a matrix.

nxN
Nxn

Variable size clib matrix, where n represents the number of columns or rows in a matrix and N represents a variable number of elements in a dimension.

matrix

Variable size clib matrix, where both dimensions of the matrix are variable.

n element

Fixed size clib vector, where n represents the fixed number of elements in the vector.

vector

Variable size clib vector.

n1x...xnN

Fixed size MATLAB array for an N dimensional array, where n1,…,nN represents the size for each dimension.

nxN
Nxn

Variable size MATLAB array, where n represents the number of columns or rows in a matrix and N represents a variable number of elements in a dimension.

Display Help for Interface to school Library

If you created the school interface in the example Header-Only HPP File, then you can use it in this example. With the schoolInterface.dll file in the current folder, type:

addpath('.')

Display the classes and functions.

doc clib.school.

then press Tab. This command loads the interface. MATLAB displays a list of members. To view the members, press the Backspace key to remove the period, then press Enter. MATLAB displays:

Classes contained in clib.school:
Person            - clib.school.Person    Representation of C++ class Person
Teacher           - clib.school.Teacher    Representation of C++ class Teacher
Student           - clib.school.Student    Representation of C++ class Student

Functions contained in clib.school:
getName           - clib.school.getName    Representation of C++ function getName

To display the inputs and outputs for the getName function, click the getName link.

clib.school.getName    Representation of C++ function getName
  Input Arguments
    p              clib.school.Person
  Output Arguments
    RetVal         string

To display class methods, call the methods function for each class. For example, type:

methods clib.school.Person
Methods for class clib.school.Person:

Person   eq       ge       getAge   getName  gt       le       lt       ne       setAge   setName  

Methods of clib.school.Person inherited from handle.

To display function signatures, call the methodsview function for each class. For example, type:

methodsview clib.school.Person

The function opens a window that displays the methods and information about arguments and returned values. For example, the signatures for the constructors are:

NameReturn TypeArguments
Personclib.school.Person obj(clib.school.Person input1)
Personclib.school.Person obj(name, uint64 scalar age)
Personclib.school.Person obj 

See Also

| |

Related Topics