MATLAB: How can I precise number in double

doublefloatMATLAB

Hello,
I want to ask you how I can precise the numbers after comma
for example:
x=0.2584
the result should be x=0.2
Please help me!

Best Answer

If the numbers are positive
x = 0.2584
y = floor(x*10)/10
If both positive and negative 'x' are possible
y = sign(x)*floor(abs(x)*10)/10