methods

Class method names

Description

example

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 function 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.

Examples

collapse all

Display the public methods of the MException class

methods MException
Methods for class MException:

addCause       eq             isequal        rethrow        throwAsCaller  
addCorrection  getReport      ne             throw          

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

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

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

MException scalar lhs1 addCause(MException scalar rhs1, MException scalar rhs2)
varargout addCorrection(MException rhs1, Correction)
logical scalar lhs1 eq(MException scalar rhs1, MException scalar rhs2)
logical lhs1 eq(MException rhs1, MException rhs2)
logical lhs1 eq(rhs1, rhs2)
unicodeString lhs1 getReport(MException scalar rhs1, asciiString rhs2, rhs3)
logical scalar lhs1 isequal(MException scalar rhs1, MException scalar rhs2)
logical scalar lhs1 isequal(MException rhs1, MException rhs2)
logical scalar lhs1 isequal(rhs1, rhs2)
Static MException scalar lhs1 last(ustringToString scalar rhs1)
logical scalar lhs1 ne(MException scalar rhs1, MException scalar rhs2)
logical lhs1 ne(MException rhs1, MException rhs2)
logical lhs1 ne(rhs1, 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.

Introduced before R2006a