Main Content

methods

Class method names

Description

methods ClassName displays the names of the methods for the class ClassName. If ClassName is a MATLAB® or Java® class, then methods displays only non-hidden, public methods, including those methods inherited from superclasses.

example

methods(obj) displays the names of the methods for the class of obj.

example

methods(___,'-full') displays a full description of the methods, including inheritance information and, for MATLAB and Java methods, method attributes and signatures. This option does not remove duplicate method names with different signatures. This option does not work with classes defined before MATLAB 7.6.

example

m = methods(___) returns the method names in a cell array of character vectors.

example

Examples

collapse all

Display the public methods of the MException class

methods MException
Methods for class MException:

MException     addCause       addCorrection  eq             getReport      isequal        ne             rethrow        throw          throwAsCaller  

Static methods:

last           

Construct a java.lang.String object and display the names of the public methods of that object.

s = java.lang.String;
methods(s);
Methods for class java.lang.String:

String               charAt               chars                codePointAt          codePointBefore      codePointCount       codePoints           compareTo            compareToIgnoreCase  concat               contains             contentEquals        copyValueOf          endsWith             equals               equalsIgnoreCase     format               getBytes             getChars             getClass             hashCode             indexOf              intern               isEmpty              join                 lastIndexOf          length               matches              notify               notifyAll            offsetByCodePoints   regionMatches        replace              replaceAll           replaceFirst         split                startsWith           subSequence          substring            toCharArray          toLowerCase          toString             toUpperCase          trim                 valueOf              wait                 

List the public methods of the MException class and show method signatures.

methods('MException','-full')
Methods for class MException:

MException lhs1 MException(asciiString rhs1, rhs2)
MException scalar lhs1 addCause(MException scalar rhs1, MException scalar rhs2)
varargout addCorrection(MException rhs1, Correction)
logical lhs1 eq(rhs1, rhs2)
logical lhs1 eq(MException rhs1, MException rhs2)
logical scalar lhs1 eq(MException scalar rhs1, MException scalar rhs2)
unicodeString lhs1 getReport(MException scalar rhs1, asciiString rhs2, rhs3)
logical scalar lhs1 isequal(rhs1, rhs2)
logical scalar lhs1 isequal(MException rhs1, MException rhs2)
logical scalar lhs1 isequal(MException scalar rhs1, MException scalar rhs2)
Static MException scalar lhs1 last(ustringToString scalar rhs1)
logical lhs1 ne(MException rhs1, MException rhs2)
logical lhs1 ne(rhs1, rhs2)
logical scalar lhs1 ne(MException scalar rhs1, MException scalar rhs2)
rethrow(MException scalar rhs1)
throw(MException scalar rhs1)
throwAsCaller(MException scalar rhs1)

Store the names of the public methods of the MException class in a cell array. Include the method signatures using the -full option.

m = methods('MException','-full');

Input Arguments

collapse all

Class name, specified as a character vector or string scalar.

Data Types: char | string

Display full description of methods, including input and output arguments

Data Types: char

Output Arguments

collapse all

Method names returned as a cell array of character vectors.

More About

collapse all

Language Dependency

This function does not show generic methods from classes based on the Microsoft® .NET Framework. Use your product documentation to get information on generic methods.

Methods Keyword

The word methods is also a MATLAB class-definition keyword. See classdef for more information on class-definition keywords.

Listed Methods

This function reports the methods from all method directories together and removes all duplicate method names from the list.

Extended Capabilities

Version History

Introduced before R2006a