# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# mustBeFinite

Validate that value is finite or issue error

## Syntax

``mustBeFinite(A)``

## Description

example

````mustBeFinite(A)` issues an error if `A` is not finite. A value is finite if it is not `NaN` or `Inf`. This function does not return a value.This function accepts user-defined objects if the class of the object implements the following method:`isfinite````

## Examples

collapse all

Use `mustBeFinite` to validate that no array elements are `NaN` or `Inf`.

```d = 0:9; A = 1./d; mustBeFinite(A)```
```Error using mustBeFinite (line 13) Value must be finite.```

The division by `d` resulted in one element becoming `Inf`, which causes an error.

This class constrains the value of `Prop1` to finite values.

```classdef MyClass properties Prop1 {mustBeFinite} end end```

Create an object and assign a value to its property.

```d = 0:9; obj = MyClass; obj.Prop1 = 1./d;```
```Error setting property 'Prop1' of class 'MyClass': Value must be finite.```

When you assign a value to the property, MATLAB® calls `mustBeFinite` with the value being assigned to the property. `mustBeFinite` issues an error because the result of division by `0` is `Inf`.

## Input Arguments

collapse all

Value to validate, specified as a scalar or an array of one of the following:

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `logical`
Complex Number Support: Yes