필터 지우기
필터 지우기

Convert a string of numbers to a number.

조회 수: 4 (최근 30일)
Poras K
Poras K 2016년 10월 5일
답변: Jos (10584) 2016년 10월 5일
Convert a string of numbers to a number without using str2num.

채택된 답변

Abhishek Jain
Abhishek Jain 2016년 10월 5일
You can use the following code.
a=[1 2 3];
b=length(a);
c=(b-1):-1:0
d=10.^c;
y=a.*d;
It converts an array containing digits to a number.
Hope that helps.

추가 답변 (1개)

Jos (10584)
Jos (10584) 2016년 10월 5일
Look mammy, no hands!
S = '6387'
N1 = sscanf(S,'%d')
N2 = (S - '0') * (10.^(numel(S)-1:-1:0)).'
% N3 = ...

카테고리

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