Matlab 字串連線
阿新 • • 發佈:2018-11-17
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 的參考頁