>> x='2';y=2;>> ischar(x)ans = 1>> ischar(y)ans = 0>> isnumeric(x)ans = 0>> isnumeric(y)ans = 1>> class(x)ans =char>> class(y)ans =double>> whos x y Name Size Bytes Class Attributes x 1x1 2 char y 1x1 8 double >> isa(x,'char')ans = 1>> isa(y,'char')ans = 0>> isa(x,'numeric')ans = 0>> isa(y,'numeric')ans = 1>>
matlab 获取字符串中的数字。
str='1999.jpg'
A=isstrprop(str,'digit')
B=str(A)
C=str2num(B)
x='2';y=2;
ischar(x)
ischar(y)
isnumeric(x);
isnumeric(y);
class(x);
class(y);
ischar(x);
whos x y Name Size Bytes Class Attributes x 1x1 2 char y 1x1 8 double
isa(x,'char');
isa(y,'char');
isa(x,'numeric');
isa(y,'numeric');
A是字符类型吧,可以转换为ASCII编码,如果是字符串的话会有单引号的‘A’.大概就是这样。