フィルターのクリア

How to round numbers to specific near point?

1 回表示 (過去 30 日間)
Triveni
Triveni 2022 年 6 月 22 日
回答済み: Stephen23 2022 年 6 月 22 日
I have a vector
A =
6.1
6.04
5.98
5.92
5.86
5.8
5.74
5.69
5.63
5.57
5.52
5.46
5.41
i want to round it near 0.05,
A =
6.1
6.05
6
5.9
5.85
.
.
.
Please help me.

採用された回答

Stephen23
Stephen23 2022 年 6 月 22 日
A = [6.1;6.04;5.98;5.92;5.86;5.8;5.74;5.69;5.63;5.57;5.52;5.46;5.41]
A = 13×1
6.1000 6.0400 5.9800 5.9200 5.8600 5.8000 5.7400 5.6900 5.6300 5.5700
N = 0.05;
B = round(A/N)*N
B = 13×1
6.1000 6.0500 6.0000 5.9000 5.8500 5.8000 5.7500 5.7000 5.6500 5.5500

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by