ismethod — Return true when an object has a public method.
ismethod(obj, methodName) returns true when methodName names a public method available on the runtime class of object instance obj. RunMat resolves inherited methods through its class registry and accepts method names as string scalars or row character vectors.
Syntax
tf = ismethod(obj, method_name)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
obj | Any | Yes | — | Object instance or gpuArray object to inspect. |
method_name | StringScalar | Yes | — | Method name as a string scalar or row character vector. |
Returns
| Name | Type | Description |
|---|---|---|
tf | LogicalArray | True when the object has the requested public method. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:IsMethodNameInvalid | The method-name argument is not a string scalar or row character vector. | ismethod: method name must be a string scalar or character vector |
How ismethod works
- Value-class and handle-class instances are inspected by runtime class name.
- Class-name text and class references are values rather than object instances, so they return
logical(0). - Explicit gpuArray values use the documented
gpuArrayobject-function surface without gathering provider buffers; internal automatic residency remains transparent and returnslogical(0)for wrapper methods. - Inherited public methods return
logical(1). - Public static methods registered for the class return
logical(1)because they are class methods visible through the class metadata. - Private and protected methods return
logical(0)for this public predicate. - Missing class names, missing method names, empty method names, ordinary numeric data, structs, cells, and function handles return
logical(0). - The method-name argument must be a string scalar or row character vector; nonscalar string arrays and nontext values raise
RunMat:IsMethodNameInvalid. - This builtin does not call user code, construct metaclass objects, or enumerate method lists.
Examples
Check an object method
tf = ismethod(obj, "step")Expected output:
tf = logical(1)Check a missing method
tf = ismethod(obj, "notARealMethod")Expected output:
tf = logical(0)Class-name text is not an object receiver
tf = ismethod("MyClass", "step")Expected output:
tf = logical(0)Using ismethod with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how ismethod changes the result.
Run a small ismethod example, explain the result, then change one input and compare the output.
FAQ
Does ismethod call the method?⌄
No. It only checks RunMat class metadata.
Does it report private methods?⌄
No. MATLAB's ismethod reports nonhidden public methods, so RunMat returns false for private and protected registry entries.
Can I pass a class name instead of an object?⌄
No. ismethod inspects an object instance. Class-name text and class references return false.
Related Introspection functions
addprop · assignin · class · clear · clearAllMemoizedCaches · clearCache · clearvars · dbclear · dbstack · dbstatus · dbtype · evalc · feval · findprop · getcallinfo · inputParser · isa · ischar · isdeployed · iskeyword · isobject · isstring · isUnderlyingType · keyboard · matlab.metadata.DynamicProperty.delete · memoize · metaclass · mislocked · mlock · munlock · namelengthmax · narginchk · nargoutchk · notify · onCleanup · stats · str2func · superclasses · underlyingType · verLessThan · version · which · who · whos
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how ismethod is executed, line by line, in Rust.
- View the source for ismethod in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.