# Documentation

### This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

# fix

Round toward zero

## Syntax

``Y = fix(X)``

## Description

example

````Y = fix(X)` rounds each element of `X` to the nearest integer toward zero. For positive `X`, the behavior of `fix` is the same as `floor`. For negative `X`, the behavior of `fix` is the same as `ceil`.```

## Examples

collapse all

`X = [-1.9 -3.4; 1.6 2.5; -4.5 4.5]`
```X = 3×2 -1.9000 -3.4000 1.6000 2.5000 -4.5000 4.5000 ```
`Y = fix(X)`
```Y = 3×2 -1 -3 1 2 -4 4 ```
`X = [1.4+2.3i 3.1-2.2i -5.3+10.9i]`
```X = 1×3 complex 1.4000 + 2.3000i 3.1000 - 2.2000i -5.3000 +10.9000i ```
`Y = fix(X)`
```Y = 1×3 complex 1.0000 + 2.0000i 3.0000 - 2.0000i -5.0000 +10.0000i ```

## Input Arguments

collapse all

Input array, specified as a scalar, vector, matrix, or multidimensional array. For complex `X`, `fix` treats the real and imaginary parts independently.

`fix` converts logical and `char` elements of `X` into `double` values.

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

## See Also

### Topics

#### Introduced before R2006a

Was this topic helpful?

#### The Manager's Guide to Solving the Big Data Conundrum

Download white paper