%%字符串char, 元组cell, 结构(字典)structure 2020.8.26 马玉华
%字符串
a = '12'
b = double(a) %将字符串中的每一个字符都转换为ASCII码
c = char(49,50)
d = str2num('12') %字符串转数字。2(two)谐音to
class(d)
e = num2str(12) %数字转字符串
class(e)
%字符串切片
f = 'abcd'
f(1)
f(1:3)
%元组和结构暂且不讲
%structure2cell, cell2structure
输出结果:
>> A4_char_cell_structure
a =
12
b =
49 50
c =
1
2
d =
12
ans =
double
e =
12
ans =
char
f =
abcd
ans =
a
ans =
abc
>>