This is machine translation

Translated by Microsoft
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.

Rounding Function

Apply rounding function to signal

  • Library:
  • Simulink / Math Operations


The Rounding Function block rounds each element of the input signal to produce the output signal.

You select the type of rounding from the Function parameter list. The name of the selected function appears on the block.


Use the Rounding Function block instead of the Fcn block when you want vector or matrix output, because the Fcn block produces only scalar output.

Also, the Rounding Function block provides two more rounding modes. The Fcn block supports floor and ceil, but does not support round and fix.



expand all

Input signal to which the rounding function is applied.

Data Types: single | double


expand all

Output signal after the rounding function is applied to the input signal. The output signal has the same dimensions and data type as the input. Each element of the output signal is the result of applying the selected rounding function to the corresponding element of the input signal.

Data Types: single | double


expand all

Choose the rounding function applied to the input signal.

Rounding functionRounds each element of the input signal
floorTo the nearest integer value towards minus infinity
ceilTo the nearest integer towards positive infinity
roundTo the nearest integer
fixTo the nearest integer towards zero

Programmatic Use

Block Parameter: Operator
Type: character vector
Values: 'floor' | 'ceil' | 'round' | 'fix'
Default: 'floor'

Specify the sample time as a value other than -1. For more information, see Specify Sample Time.


This parameter is not visible unless it is explicitly set to a value other than -1. To learn more, see Blocks for Which Sample Time Is Not Recommended.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '-1'

Block Characteristics

Data Types

double | single

Direct Feedthrough


Multidimensional Signals


Variable-Size Signals


Zero-Crossing Detection


Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

See Also

Introduced before R2006a