ismethod — Return true when an object has a public method.

ismethod(objOrClass, methodName) returns true when methodName names a public method available on the runtime class of objOrClass. RunMat resolves inherited methods through its class registry and accepts object receivers, class-name text, class references, gpuArray handles, and method names as string scalars or row character vectors.

Syntax

tf = ismethod(obj, method_name)

Inputs

NameTypeRequiredDefaultDescription
objAnyYesObject, class name, class reference, or gpuArray value to inspect.
method_nameStringScalarYesMethod name as a string scalar or row character vector.

Returns

NameTypeDescription
tfLogicalArrayTrue when the object has the requested public method.

Errors

IdentifierWhenMessage
RunMat:IsMethodNameInvalidThe 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 string scalars and row character vectors are resolved against the same class registry metadata.
  • Class references are resolved by referenced class name.
  • gpuArray values are treated as the gpuArray class for metadata lookup without gathering provider buffers; they return true only when the requested public method is registered for gpuArray.
  • 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)

Check a method by class name

tf = ismethod("MyClass", "step")

Expected output:

tf = logical(1)

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?

Yes. String scalars and row character vectors are interpreted as class names for metadata lookup.

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how ismethod is executed, line by line, in Rust.

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.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.