How do I get -0.966 from the string B as a number
B = α -0.966 ° OK 4.000 -15.000 ° 23.000 ° Freiwinkel
I'm missing the minus when I do this:
out_all= regexp(B, '\w*\d', 'Match');
out_all = out_all{1,1};
Radius = append(out_all{1},'.',out_all{2});

 채택된 답변

Stephen23
Stephen23 2022년 6월 10일

0 개 추천

B = 'α -0.966 ° OK 4.000 -15.000 ° 23.000 ° Freiwinkel'
B = 'α -0.966 ° OK 4.000 -15.000 ° 23.000 ° Freiwinkel'
C = regexp(B,'[-+]?\d+\.?\d*', 'match')
C = 1×4 cell array
{'-0.966'} {'4.000'} {'-15.000'} {'23.000'}
V = str2double(C)
V = 1×4
-0.9660 4.0000 -15.0000 23.0000

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Signal Processing Toolbox에 대해 자세히 알아보기

제품

릴리스

R2019a

태그

질문:

2022년 6월 10일

댓글:

2022년 6월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by