matlab中双引号“”和单引号‘’字符串连接时的区别

用“”时不能用数组连接字符串

>> s1="12",s2="34",s3="45"
s1 =
    "12"
s2 =
    "34"
s3 =
    "45"
>> str=[s1,s2,s3]
str =
  1×3 string 数组
    "12"    "34"    "45"
>> s1='12',s2='34',s3='45'
s1 =
    '12'
s2 =
    '34'
s3 =
    '45'
>> [s1,s2,s3]
ans =
    '123445'


strcat字符串链接函数要使字符串之间有空格,要用“ ”,而不是‘’

>> strcat(s1,' ',s2,' ',s3)
ans =
    "123445"
>> strcat(s1," ",s2," ",s3)
ans =
    "12 34 45"

 

相关推荐
©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页