How to eliminate values after comma, in double value?
5 views (last 30 days)
Show older comments
Hi every one,
I have a problem
I have a set of double values
like
0.2000 0.2862
I want just use 0.2 and 0.2, I don t need zeros after
Accepted Answer
Stephen23
on 24 Jan 2023
A wild guess:
V = [0.2,0.2862]
W = fix(V*10)/10
2 Comments
Stephen23
on 24 Jan 2023
Edited: Stephen23
on 24 Jan 2023
"but I need also to remove these zeros the results that I want is 0.2 and 0.2"
Then you need to first answer my question here:
It is certainly possible to display numeric values with a certain number of fractional zeros, or select the number of fractional zeros when converting to text:
N = 0.2
S = sprintf('%.1f',N)
But so far you have not made it clear if text is what you require.
More Answers (0)
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!