methods - Information on class methods

Syntax

methods('classname')
methods(obj)
methods(...,'-full')
m = methods(...)

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 public methods, including those inherited from superclasses.

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

methods(...,'-full') displays a full description of the methods, including inheritance information and, for MATLAB and Java methods, method attributes and signatures. Duplicate method names with different signatures are not removed. Note that this option does not work with classes using pre MATLAB Version 7.6 class definitions (i.e., classes not using the classdef syntax).

m = methods(...) returns the method names in a cell array of strings.

Examples

Retrieve the names of the static methods in class memmapfile:

m = methods('memmapfile','-full');
for k=1:length(m)
   if ~isempty(findstr(m{k},'Static'))
      disp(m(k))
   end
end

    'Static DeleteDataHandle(dh)'

    'Static E empty(varargin)'

    'Static obj loadobj(obj)'

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

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

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

See Also

methodsview, properties, events, what, which

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS