This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Calling .NET Methods

Calling Object Methods

This topic describes information specific to .NET methods. For general information about calling methods on objects in MATLAB®, see Methods and Functions.

Getting Method Information

Use the following MATLAB functions to view the methods of a class. You can use these functions without creating an instance of the class. These functions do not list generic methods; use your product documentation to get information on generic methods.

  • methods — View method names

  • methods with '-full' option — View method names with argument list

  • methodsview — Graphical representation of method list

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. For example, open a methodsview window for the System.String class:

methodsview('System.String')

C# Method Access Modifiers

MATLAB maps C# keywords to MATLAB method access attributes, as shown in the following table.

C# Method KeywordMATLAB AttributeExample
ref

RHS, LHS

Call .NET Methods With ref Keyword

out

LHS

Call .NET Methods With out Keyword

params

Array of particular type

Call .NET Methods With params Keyword

protected, private, internal, protected internal

Not visible to MATLAB

 

VB.NET Method Access Modifiers

MATLAB maps VB.NET keywords to MATLAB method access attributes, as shown in the following table.

VB.NET Method KeywordMATLAB Attribute
ByRefLHS, RHS
ByValRHS
OptionalMandatory

Reading Method Signatures

MATLAB uses the following rules to populate method signatures.

  • obj is the output from the constructor.

  • this is the object argument.

  • RetVal is the return type of a method.

  • All other arguments use the .NET metadata.

MATLAB uses the following rules to select a method signature.

  • Number of inputs

  • Input type

  • Number of outputs