请问matlab里面如何区分A是数字还是字符串

新手请问高手们在matlab里面如何A是数字还是字符串,应该是个很简单的问题吧,谢谢了

>> 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>>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-04-04

matlab 获取中的数字。

str='1999.jpg'

A=isstrprop(str,'digit')

B=str(A)

C=str2num(B)

本回答被网友采纳
第2个回答  2016-11-16
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');本回答被网友采纳
第3个回答  2017-12-26
A是字符类型吧,可以转换为ASCII编码,如果是字符串的话会有单引号的‘A’.大概就是这样。

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网