フィルターのクリア

extract the number with only the first decimal number

13 ビュー (過去 30 日間)
Alberto Acri
Alberto Acri 2023 年 9 月 20 日
コメント済み: Alberto Acri 2023 年 9 月 20 日
I have to extract the number with only the first decimal number
Examples:
1.23 -> 1.2
2.49 -> 2.4
4.77 -> 4.7
7.51 -> 7.5
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 20 日
Extract as in? Do you want to store it in string/char/cell array of character vectors?
Alberto Acri
Alberto Acri 2023 年 9 月 20 日
double!

サインインしてコメントする。

採用された回答

Cris LaPierre
Cris LaPierre 2023 年 9 月 20 日
I'd look into fix or floor.
V = [1.23, 2.49, 4.77, 7.51];
v1 = floor(V*10)/10
v1 = 1×4
1.2000 2.4000 4.7000 7.5000
v2 = fix(V*10)/10
v2 = 1×4
1.2000 2.4000 4.7000 7.5000

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by