convert string to number or array

조회 수: 7 (최근 30일)
TTA
TTA 2019년 10월 8일
답변: the cyclist 2019년 10월 8일
Please I want to convert this array to an array. if I use str2double I obtain those starting 0.something as NAN.
please help
' 0. 9'
' 0. 9'
' 1. 2'
' 1. 4'
' 1.14'
' 1.39'
' 1.42'
' 1.45'
' 1.46'
' 1.59'
' 2.28'
' 2.34'
' 2.43'
' 3.18'
' 3.35'
' 4.10'
' 4.48'
'11.24'
'11.33'
'11.33'
'12.13'
'12.32'
'12.54'
'13. 2'
'13. 5'
'13. 9'
'13.13'
'13.13'
'13.22'
'13.22'
'13.50'
'13.57'
'14.16'
'14.19'
'14.41'
'14.42'
'14.44'
'14.46'
'14.48'
'14.53'
'14.53'
'14.57'
'15.33'
'15.33'
'15.59'
'16. 6'
'16.10'
'16.12'
'16.14'
'16.19'
'16.27'
'16.37'
'16.37'
'17. 7'
'17.14'
'17.27'
'17.40'
'17.47'
'17.51'
'18. 4'
'18. 4'
'21.26'
'21.26'
'21.29'
'23.10'
'23.18'
'23.44'
'23.48'
'23.57'

채택된 답변

the cyclist
the cyclist 2019년 10월 8일
I'm guessing it's the space that is causing the problem. Run your array through
x = regexprep(x,' ','');
first to remove the spaces.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by