C = round(A)
C = round(A, N)
C = round(A, N, 'decimals')
C = round(A, N, 'significant')
| Parameter | Description |
|---|---|
| A | a variable |
| N | number of digits: real integer scalar. |
| type | 'decimals' (default) or 'significant'. |
| Parameter | Description |
|---|---|
| C | result of round. |
round rounds the elements to the nearest integers.
round(A, N) rounds to N digits to the right of the decimal point (N may be negative). This is the same as round(A, N, 'decimals').
round(A, N, 'significant') rounds to N significant digits; here N must be positive.
Sparse single and sparse single complex inputs are supported. Only stored nonzero entries are rounded and the result keeps the sparse storage and the input precision.
round(pi)
round(3.14159, 2)
round(12345, 2, 'significant')
S = sparse(single([1.2 0; -2.7 3.1]));
C = round(S)
| Version | Description |
|---|---|
| 1.0.0 | initial version |
| 2.0.0 | sparse single and sparse single complex inputs supported. |
| 2.0.0 | round(A, N) and the 'decimals' / 'significant' options added. |