Matlab 字符串连接

example1:

str = 'www'

str =

www

>> str2 = 'hello'

str2 =

hello

>> [str,str2]

ans =

wwwhello

example2:

>> str3 = 'welcome'

str3 =

welcome

>> strcat(str,str3)

ans =

wwwwelcome

example3:

strcat({'red','yellow'},{'green','blue'})

ans = 

    'redgreen'    'yellowblue'

example4:

>> strcat(['red','yellow'],['green','blue'])

ans =

redyellowgreenblue

遇到matlab里面的不懂的方法,第一方法应该是使用 help + 方法名,来看matlab文档。
example:

>> help strcat
strcat - Concatenate strings horizontally

    This MATLAB function horizontally concatenates strings s1,...,sN.

    s = strcat(s1,...,sN)

    strcat 的参考页

    另请参阅 cat, cellstr, horzcat, strjoin, vertcat

% 点击  ** 的参考页 即可,查看详细文档
>> help exist
exist - Check existence of variable, function, folder, or class

    This MATLAB function returns the status of name:

    exist name
    exist name kind
    A = exist('name','kind')

    exist 的参考页


猜你喜欢

转载自blog.csdn.net/sinat_28442665/article/details/83149684
今日推荐