mustBeTextScalar — Validate that a value is a scalar text value.
mustBeTextScalar is available as a callable MATLAB argument validator. It returns no user-facing value when validation passes and throws a structured RunMat error when validation fails. Validators with literal/static payloads are also encoded in MATLAB arguments blocks; dynamic validator payload expressions should call the validator directly until runtime-evaluated arguments-block payloads are implemented.
Syntax
mustBeTextScalar(A)Inputs
A- Type
Any- Required
- Yes
- Description
- Value to validate or inspect.
Errors
RunMat:mustBeTextScalar:TooManyOutputs- When
- Any output is explicitly requested from this zero-output validator.
- Message
mustBeTextScalar: too many output arguments
RunMat:mustBeTextScalar:InvalidArgument- When
- The supported input count, control type, or option contract is violated.
- Message
mustBeTextScalar: invalid argument
RunMat:mustBeTextScalar:ValidationFailed- When
- The supplied value does not satisfy the validator.
- Message
mustBeTextScalar: value does not satisfy validator
Behavior
Callable validator forms enforce exact supported arity, throw on validation failure, and suppress automatic output on success.
Integer values are not text scalars and fail without numeric conversion; resident integer values reject before provider lookup or payload access.
Arguments-block validation uses the same shared runtime predicates for validators that RunMat can encode statically.
Numeric validators check every element without materializing a cloned numeric array, including sparse stored values and implicit sparse zeros where relevant.
Text validators accept string scalars/arrays, character row vectors, and compatible cell arrays of text where MATLAB commonly permits them.
Residency and provider behavior
Validators run on host values and metadata; they throw on validation failure.
Execution contract
The runtime binding is portable across interpreter, native/JIT/AOT and WASM routes. Metadata and text checks do not upload or gather operands. Invalid output counts and controls reject before provider payload access.
This validator has zero public outputs. A statement or arguments-block check validates normally; explicitly assigning a result is an error. An internal ABI return carrier is not a public output.
The operation has no callbacks, filesystem, randomness, workspace mutation or foreign-runtime calls. Distributed values are inspected only as opaque handles, never materialized or validated partition-by-partition.
Example
Using the validator as a normal callable guard
A = 'text';
mustBeTextScalar(A);
passed = true;Expected output:
No output when validation passes; an error is thrown when validation fails.Using mustBeTextScalar with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how mustBeTextScalar changes the result.
Run a small mustBeTextScalar example, explain the result, then change one input and compare the output.
FAQ
Does this validator work in an arguments block?⌄
Yes for literal/static validator payloads that RunMat can encode at compile time. Dynamic validator payload expressions should use the callable form for now.
Related Argument Validation functions
isvarname · mustBeA · mustBeColumn · mustBeFile · mustBeFinite · mustBeFloat · mustBeFolder · mustBeGreaterThan · mustBeGreaterThanOrEqual · mustBeInRange · mustBeInteger · mustBeLessThan · mustBeLessThanOrEqual · mustBeMember · mustBeNegative · mustBeNonempty · mustBeNonmissing · mustBeNonNan · mustBeNonnegative · mustBeNonpositive · mustBeNonsparse · mustBeNonzero · mustBeNonzeroLengthText · mustBeNumeric · mustBeNumericOrLogical · mustBePositive · mustBeReal · mustBeScalarOrEmpty · mustBeSparse · mustBeText · mustBeUnderlyingType · mustBeValidVariableName · mustBeVector · namedargs2cell · validateFunctionSignaturesJSON
Source you can read
Every RunMat function's source is public. Read exactly how mustBeTextScalar is executed, line by line, in Rust.
- View the source for mustBeTextScalar 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.