convert char to double
조회 수: 27 (최근 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!