Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert decimals into integers in matlab, urgent!
How to convert decimals into integers in matlab, urgent!

According to your needs, you can use the fix, ceil, floor, and round functions.

The rounding rules of these functions are different: fix only retains the integer part, ceil rounds up, floor rounds down, and round rounds up. These functions are different and cannot replace each other.

Let’s experience it through specific examples: >>?x=[-1.6?-1.4?1.4?1.6?3];

>>?fix(x)

p>

ans?=

-1-1?1?1?3

>>?ceil(x)

ans?=< /p>

-1-1?2?2?3

>>?floor(x)

ans?=

-2- 2?1?1?3

>>?round(x)

ans?=

-2-1?1?2?3