Convert a string of numbers to a number.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Poras K
am 5 Okt. 2016
Beantwortet: Jos (10584)
am 5 Okt. 2016
Convert a string of numbers to a number without using str2num.
Akzeptierte Antwort
Abhishek Jain
am 5 Okt. 2016
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.
0 Kommentare
Weitere Antworten (1)
Jos (10584)
am 5 Okt. 2016
Look mammy, no hands!
S = '6387'
N1 = sscanf(S,'%d')
N2 = (S - '0') * (10.^(numel(S)-1:-1:0)).'
% N3 = ...
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!