Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 在matlab中将字符串转换为数字数组
我有一个包含值'1' '2' '3'char 值的向量 y,我想将其转换为相应的整数向量。如果我使用str2num它会给出49 50 51类似的数字。我该怎么做?
'1' '2' '3'
str2num
49 50 51
y - '0'
'0'利用数字的 ASCII 值是连续的这一事实,从每个向量元素中减去 ASCII 值。
'0'