convert char to double
33 ビュー (過去 30 日間)
古いコメントを表示
var = '0' (this is char)
and i want this value convert 'double'
so i used
out = str2double(regexp(var,'\d*','match')
But I have a parse error
How can I get the val value in double?
For reference, if str2double is used, the NAN value is obtained.
1 件のコメント
回答 (1 件)
Davide Masiello
2022 年 9 月 27 日
編集済み: Davide Masiello
2022 年 9 月 27 日
var = '0';
out = str2double(var)
whos out
No need to use regular expressions at all, at least in Matlab.
3 件のコメント
Davide Masiello
2022 年 9 月 27 日
What you see in my answer is obtained running Matlab R2022b.
What version do you use?
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!