Why there is no truncate function in Matlab?
88 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I need to truncate values in a For loop and round() isn't working. I was just wondering why there is no truncate function yet?
0 件のコメント
採用された回答
Image Analyst
2017 年 8 月 24 日
Because round sometimes rounds up - away from zero. I think you may want to use fix() instead of round(). It always rounds towards zero, in other words, truncates. See if that works for you and let me know.
2 件のコメント
Walter Roberson
2017 年 8 月 24 日
You should also know about floor(), which rounds towards negative infinity -- the maximum integer less than or equal to the input.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!