You execute, or invoke, COM functions or methods belonging to COM objects. Method names are case-sensitive. You cannot abbreviate them.
To see what methods a COM object supports, use one of the following functions. Each function presents specific information, as described in the table. For information about using a method, refer to your vendor documentation.
Function | Output |
---|---|
Graphical display of function names and signatures | |
| Cell array of function names and signatures, sorted alphabetically |
Cell array of function names only, sorted alphabetically, with uppercase names listed first | |
Cell array of function names and signatures |
MATLAB® supports the following syntaxes to call methods on an object.
By method name:
outputvalue = methodname(object,'arg1','arg2',...);
By dot notation:
outputvalue = object.methodname('arg1','arg2',...);
Using explicit syntax:
outputvalue = invoke(object,'methodname','arg1','arg2',...);
The methodsview
and methods
-full
commands
show what data types to use for input and output arguments.
You cannot use dot syntax and must explicitly call the get
, set
,
and invoke
functions under the following conditions:
To access a property or method that is not a public member of the object class.
To access a property or method that is not in the type library for the control or server.
To access properties that take arguments. MATLAB treats these properties like methods.
To access properties on a vector of objects, use the get
and set
functions.
You cannot invoke a method on multiple COM objects, even if
you call the invoke
function explicitly.
Enumeration is a way of assigning a descriptive name to a symbolic
value. MATLAB supports enumeration for parameters passed to methods
under the condition that the type library in use reports the parameter
as ENUM
, and only as ENUM
.
MATLAB does not support enumeration for any parameter that
the type library reports as both ENUM
and Optional
.
When calling a method that takes optional input arguments, you
can skip an optional argument by specifying an empty array ([]
)
in its place. For example, the syntax for calling a method with second
argument arg2
not specified is:
methodname(handle,arg1,[],arg3);
If a server function supports multiple outputs, you can return any or all those outputs to a MATLAB client.
The following syntax shows a server function functionname
called
by the MATLAB client. retval
is the first
output argument, or return value. The other output arguments are out1
, out2
, ...
.
[retval out1 out2 ...] = functionname(handle,in1,in2,...);
MATLAB uses the pass-by-reference capabilities in COM to implement this feature. Pass-by-reference is a COM feature; MATLAB does not support pass-by-reference.