convert string to number or array

1 次查看(过去 30 天)
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