フィルターのクリア

Insert comma/point in a number

3 ビュー (過去 30 日間)
Michela Longhi
Michela Longhi 2017 年 12 月 12 日
コメント済み: Star Strider 2017 年 12 月 12 日
I have a temperature data in a char format without comma or point to divide the decimal and I want to insert a point after the second number (staring from the left):
char= 225800 and I want t=22.58
Can someone help me, please?
Thank you
Michela

採用された回答

Star Strider
Star Strider 2017 年 12 月 12 日
I am not certain what you are doing.
I assume ‘char’ is a character vector. If so, this will work:
char = '225800';
t = str2double(char)*1E-4 % Double-Precision Numeric
tstr = sprintf('%.2f', t) % Character Array
t =
22.5800
tstr =
'22.58'
  2 件のコメント
Michela Longhi
Michela Longhi 2017 年 12 月 12 日
exaclty what I immagine! Thanks
Star Strider
Star Strider 2017 年 12 月 12 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by