>> apple_char='apple'
apple_char =
'apple'
>> class(apple_char)
ans =
'char'
>> Apple_String="Apple"
Apple_String =
"Apple"
>> class(Apple_String)
ans =
'string'
>> length(apple_char)
ans =
5
>> length(Apple_String)
ans =
1
>> Apple_String % 是一个scalar
Apple_String =
"Apple"
>> apple_char % 是一个array /vector
apple_char =
'apple'
>> size(apple_char)
ans =
1 5
>> size(Apple_String)
ans =
1 1
>> apple_char(3)
ans =
'p'
>> Apple_String(1)
ans =
"Apple"
>> Apple_String(2)
索引超出数组元素的数目(1)。
>>
>> Apple_String{1}(4)% 如果要找到这个string的某个字符,返回的就是char 类型的
ans =
'l'
数组:
>> major=["chinese" "histroy" "engerinid"]
major =
1×3 string 数组
"chinese" "histroy" "engerinid"
>> major_char=['dddd','eeee','fffff']
major_char =
'ddddeeeefffff'
>> major_char1=char(['dddd','eeee','fffff'])
major_char1 =
'ddddeeeefffff'
>> major_char1=char('dddd','eeee','fffff')
major_char1 =
3×5 char 数组
'dddd '
'eeee '
'fffff'
>>
ans =
空的 0×0 char 数组
>> ['','','']
ans =
空的 0×0 char 数组
>> ""
ans =
""
>> ["",""]
ans =
1×2 string 数组
"" ""
>>
>> isempty('')
ans =
logical
1
>> isempty([])
ans =
logical
1
>> isempty("")
ans =
logical
0
>>