Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

methods

类方法名称

说明

示例

methods ClassName 显示类 ClassName 的方法的名称。如果 ClassName 为 MATLAB® 或 Java® 类,则 methods 仅显示非隐藏的公共方法,包括从超类继承的方法。

示例

methods(obj) 显示 obj 的类的方法的名称。

示例

methods(___,'-full') 显示方法的完整说明,包括继承信息,对于 MATLAB 和 Java 方法,还包括方法特性和签名。此选项不会删除具有不同签名的重复方法名称。此选项不适用于在 MATLAB 7.6 之前定义的类。

示例

m = methods(___) 以字符向量元胞数组的形式返回方法名称。

示例

全部折叠

显示 MException 类的公共方法

methods MException
Methods for class MException:

MException     addCause       addCorrection  eq             getReport      isequal        ne             rethrow        throw          throwAsCaller  

Static methods:

last           

构造一个 java.lang.String 对象,并显示该对象的公共方法的名称。

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                 

列出 MException 类的公共方法并显示方法签名。

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 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 rhs1, MException rhs2)
logical scalar lhs1 isequal(rhs1, rhs2)
logical scalar lhs1 isequal(MException scalar rhs1, MException scalar 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)

将 MException 类的公共方法的名称存储在元胞数组中。使用 -full 选项包含方法签名。

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

输入参数

全部折叠

类名,指定为字符向量或字符串标量。

数据类型: char | string

显示方法的完整说明,包括输入和输出参数

数据类型: char

输出参数

全部折叠

方法名称,以字符向量元胞数组形式返回。

详细信息

全部折叠

语言依存关系

此函数不显示基于 Microsoft® .NET Framework 的类的泛型方法。使用产品文档获取有关泛型方法的信息。

methods 关键字

methods 一词还是一个 MATLAB 类定义关键字。有关类定义关键字的详细信息,请参阅 classdef

列出的方法

此函数将所有方法目录中的方法汇总在一起,并从列表中删除所有重复的方法名称。

扩展功能

版本历史记录

在 R2006a 之前推出

另请参阅

| |

主题