statget — Read values from statistics options structures.

statget(options,field) returns a field value from a statistics options struct. statget(options,field,defaultData) returns defaultData when the selected field is empty.

Syntax

val = statget(options, field)
val = statget(options, field, defaultData)

Inputs

NameTypeRequiredDefaultDescription
optionsAnyYesStatistics options structure.
fieldStringScalarYesOption field name or unique leading prefix.
defaultDataAnyNoValue returned when the selected option is empty.

Returns

NameTypeDescription
valAnyOption field value.

Errors

IdentifierWhenMessage
RunMat:statget:InvalidArgumentArgument grammar does not match statget forms.statget: invalid argument
RunMat:statget:InvalidOptionThe options argument is not a struct or the field argument is not text.statget: invalid option

How statget works

  • options must be a struct, typically created by statset.
  • field is matched case-insensitively and can be a unique leading prefix of a known statistics option field.
  • If the requested field is recognized but empty, statget returns the supplied default value when present, otherwise it returns the empty value.
  • If the requested field is not recognized or is ambiguous, RunMat returns an empty numeric value for compatibility with loose MATLAB option probing.

Examples

Read an explicit option

opts = statset('TolX', 1e-8);
tol = statget(opts, 'TolX')

Expected output:

`tol` is `1e-8`.

Use a default for an empty option

opts = statset('MaxIter', 100);
tol = statget(opts, 'TolFun', 1e-6)

Expected output:

`tol` is `1e-6` because `TolFun` is empty.

Use a unique prefix

opts = statset('MaxIter', 100);
iter = statget(opts, 'MaxI')

Expected output:

`iter` is `100`.

Using statget with coding agents

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

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

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how statget 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.