nanmin — Minimum that ignores NaN values.
nanmin(A, ...) is the NaN-omitting compatibility alias for min(A, ..., "omitnan").
Syntax
y = nanmin(A, ...)
y = nanmin(A, B)
y = nanmin(A, [], dim_or_options)Inputs
A- Type
NumericArray- Required
- Yes
- Description
- Numeric data.
args- Type
Any- Required
- Variadic
- Description
- Supported dimension, normalization, or output-class controls.
A- Type
NumericArray- Required
- Yes
- Description
- First numeric operand.
B- Type
NumericArray- Required
- Yes
- Description
- Second numeric operand, equal-shaped or scalar.
A- Type
NumericArray- Required
- Yes
- Description
- Numeric data to reduce.
placeholder- Type
Any- Required
- Yes
- Default
[]- Description
- Empty placeholder distinguishing reduction from pairwise comparison.
dim_or_options- Type
Any- Required
- Variadic
- Description
- Optional dimension or all selector.
Returns
y- Type
NumericArray- Description
- NaN-omitting reduction result.
I- Type
NumericArray- Description
- One-based indices of selected minima.
y- Type
NumericArray- Description
- NaN-omitting result.
Returned values from nanmin depend on how many outputs the caller requests.
Errors
RunMat:missing:InvalidArgument- When
- The input count or alias-specific argument form is invalid.
- Message
missing-value builtin: invalid argument
RunMat:missing:UnsupportedType- When
- The data class has no supported alias form.
- Message
missing-value builtin: unsupported input type
RunMat:missing:InternalError- When
- Missing-value wrapper materialization fails.
- Message
missing-value builtin: internal error
Forms and output
Reduction forms use min with omitnan; pass [] before a numeric dimension. A reduction can also return one-based indices as its second output. The legacy two-numeric-input form compares pairwise, takes the non-NaN operand when exactly one is NaN, and supports one output.
Typed integer reduction and compatible pairwise forms retain exact integer storage in RunMat mode.
Execution
The alias uses the admitted parent reduction implementation, including its supported resident/provider route and structured fallback. A successful catalog binding alone does not demonstrate a GPU kernel for every option or class.
Examples
Ignore NaN values
m = nanmin([NaN 2 3])Expected output:
m = 2Pairwise minima
B = nanmin([NaN 4 3], [2 NaN 5])Expected output:
B = [2 4 3]Using nanmin with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how nanmin changes the result.
Run a small nanmin example, explain the result, then change one input and compare the output.
Related Missing functions
anymissing · fillmissing · ismissing · missing · movmad · nanmean · nanmedian · nanstd · nansum · nanvar · rmmissing · standardizeMissing
Source you can read
Every RunMat function's source is public. Read exactly how nanmin is executed, line by line, in Rust.
- View the source for nanmin 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.