Convert String to numbers

조회 수: 3 (최근 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에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by