how to convert array of strings into array of double or int

14 ビュー (過去 30 日間)
Saqlain Asad
Saqlain Asad 2019 年 9 月 3 日
コメント済み: Saqlain Asad 2019 年 9 月 3 日
hello everyone,
I want to convert an array of string which has numbers into an array of numbers (double).
The char array i want to convert is : sad.PNG
i want to convert the same numbers to a double array:
but the when i use str2num it gives me this: Capture.PNG
and if i use str2double it returns inf.
how to solve this need help

採用された回答

Steven Lord
Steven Lord 2019 年 9 月 3 日
That str2num output looks right for format short. You overlooked the scale factor at the top of the display of that matrix.
>> format short
>> 40220151038 + [0; 1]
ans =
1.0e+10 *
4.0220
4.0220
Try using display format longg instead of the default format short.
>> format longg
40220151038 + [0; 1]
ans =
40220151038
40220151039
  1 件のコメント
Saqlain Asad
Saqlain Asad 2019 年 9 月 3 日
Thank you so much.. it works i understand it now

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by