RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

RunMat® is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

/
See all docs
Builtin Reference
    • addlistener
    • addParameter
    • addprop
    • assignin
    • builtin
    • cancel
    • class
    • clear
    • clearAllMemoizedCaches
    • clearCache
    • clearvars
    • dbclear
    • dbstack
    • dbstatus
    • dbtype
    • eval
    • evalc
    • evalin
    • feval
    • findprop
    • func2str
    • functions
    • get.p
    • getcallinfo
    • getmethod
    • inputname
    • inputParser
    • isa
    • ischar
    • isdeployed
    • iskeyword
    • ismethod
    • isobject
    • isstring
    • isUnderlyingType
    • isvalid
    • keyboard
    • loadobj
    • localfunctions
    • matlab.metadata.DynamicProperty.delete
    • memoize
    • metaclass
    • mfilename
    • mislocked
    • mlock
    • munlock
    • namelengthmax
    • narginchk
    • nargoutchk
    • new_object
    • notify
    • numArgumentsFromSubscript
    • onCleanup
    • parse
    • saveobj
    • set.p
    • stats
    • str2func
    • subsasgn
    • subsref
    • superclasses
    • underlyingType
    • verLessThan
    • version
    • which
    • who
    • whos

ischar — Test whether a value is a character array in MATLAB and RunMat.

tf = ischar(x) returns true when x is a character array (char row vector or char matrix) and false otherwise. Distinction from string arrays and other types follows MATLAB semantics.

Syntax

tf = ischar(A)

Inputs

A
Type
Any
Required
Yes
Description
Value inspected from metadata without payload conversion.
NameTypeRequiredDefaultDescription
AAnyYes—Value inspected from metadata without payload conversion.

Returns

tf
Type
LogicalArray
Description
Scalar logical type-query result.
NameTypeDescription
tfLogicalArrayScalar logical type-query result.

Behavior

Character vectors such as 'RunMat' and char matrices created with ['A'; 'B'] return true.

Empty char arrays (including '' and char.empty(...)) still count as character arrays.

String scalars, string arrays, cell arrays, numeric values, and logical masks all return false.

gpuArray inputs return false unless they are explicitly stored as char arrays (which RunMat does not currently support), matching MATLAB’s behaviour where gpuArray does not host char data.

The result is always a host logical scalar (logical(0) or logical(1)), so it can be used in branching, masking, or validation code without additional conversions.

GPU and residency

ischar never launches GPU kernels. When you pass a gpuArray value, RunMat inspects the residency metadata and simply reports false because device-resident buffers are numeric or logical. This matches MATLAB’s semantics and avoids unnecessary host↔device transfers.

You usually do NOT need to call gpuArray yourself in RunMat (unlike MATLAB).

In RunMat, the fusion planner keeps residency on GPU in branches of fused expressions. As such, calling ischar on a gpuArray result preserves the device buffer, and ischar answers the query using metadata only.

To preserve backwards compatibility with MathWorks MATLAB, and for when you want to explicitly bootstrap GPU residency, you can call gpuArray explicitly to move data to the GPU if you want to be explicit about the residency.

Since MathWorks MATLAB does not have a fusion planner, and they kept their parallel execution toolbox separate from the core language, as their toolbox is a separate commercial product, MathWorks MATLAB users need to call gpuArray to move data to the GPU manually whereas RunMat users can rely on the fusion planner to keep data on the GPU automatically.

Returns a host logical scalar; GPU inputs are inspected without launching kernels.

Legacy examples and displayed results

Checking if a character vector is a char array

tf = ischar('RunMat')

Expected display: tf = logical(1)

Detecting multi-row char matrices

letters = ['ab'; 'cd'];

tf = ischar(letters)

Expected display: tf = logical(1)

Distinguishing between char arrays and string scalars

tf_char = ischar('hello');

tf_string = ischar("hello")

Expected display: tf_char = logical(1)

tf_string = logical(0)

Recognising that numeric and logical data are not char arrays

numbers = [1 2 3];

mask = true(1, 3);

tf_numbers = ischar(numbers);

tf_mask = ischar(mask)

Expected display: tf_numbers = logical(0)

tf_mask = logical(0)

Testing gpuArray inputs

G = gpuArray(ones(2, 2));

tf_gpu = ischar(G)

Expected display: tf_gpu = logical(0)

Example

Inspect a type with an assertion

tf = ischar('RunMat')

Using ischar with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how ischar changes the result.

Run a small ischar example, explain the result, then change one input and compare the output.

FAQ

Does ischar treat empty character arrays as char?⌄

Yes. Both '' and arrays created with char.empty return logical(1) because they are still character arrays, even when they have zero elements.

Why does ischar return false for string scalars?⌄

Strings in MATLAB are a distinct type introduced in R2016b. They are not interchangeable with char arrays, so ischar("text") correctly returns logical(0).

What about cell arrays of characters?⌄

Cell arrays such as {'a', 'b'} return logical(0) because they are cell containers rather than a single char array. Use iscellstr if you need to validate cell-of-char collections.

Can gpuArray hold char data in RunMat?⌄

Not currently. gpuArray values in RunMat contain numeric or logical tensors, so ischar reports false for all gpuArray inputs, mirroring MATLAB’s behaviour.

How do I convert a string to a char array if ischar returns false?⌄

Use char(stringScalar) or the convertStringsToChars utility when you need to operate on char arrays for legacy APIs.

Is there any performance cost when checking large arrays?⌄

No. ischar only inspects the value’s metadata; it does not copy or iterate over the array elements, so the cost is constant regardless of array size.

Related Introspection functions

addlistener · addParameter · addprop · assignin · builtin · cancel · class · clear · clearAllMemoizedCaches · clearCache · clearvars · dbclear · dbstack · dbstatus · dbtype · eval · evalc · evalin · feval · findprop · func2str · functions · get.p · getcallinfo · getmethod · inputname · inputParser · isa · isdeployed · iskeyword · ismethod · isobject · isstring · isUnderlyingType · isvalid · keyboard · loadobj · localfunctions · matlab.metadata.DynamicProperty.delete · memoize · metaclass · mfilename · mislocked · mlock · munlock · namelengthmax · narginchk · nargoutchk · new_object · notify · numArgumentsFromSubscript · onCleanup · parse · saveobj · set.p · stats · str2func · subsasgn · subsref · superclasses · underlyingType · verLessThan · version · which · who · whos

Source you can read

Every RunMat function's source is public. Read exactly how ischar is executed, line by line, in Rust.

  • View the source for ischar in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Behavior
  • GPU and residency
  • Legacy examples and displayed results
  • Example
  • Inspect a type with an assertion
  • Using ischar with coding agents
  • FAQ
  • Related Introspection functions
  • Source you can read
  • About RunMat