Convert String to numbers

6 次查看(过去 30 天)
flashpode
flashpode 2021-9-16
评论: flashpode 2021-9-16
Hey I've got a problem. I have to convert a String (200x1) that each line has four numbers:
0000
0001
0002
0003
...
...
...
to number, to be able to do operations. I used str2num but it comes error: Input must be a character vector or string scalar.

回答(1 个)

Sean de Wolski
Sean de Wolski 2021-9-16
s = ["0001" "0002"]
s = 1×2 string array
"0001" "0002"
n = double(s)
n = 1×2
1 2
  1 个评论
flashpode
flashpode 2021-9-16
I do not want to change the 0000 0001 and those numbers I just want to operate with them

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by