正在加载图片...
函数eval,feva的基本用途限在用户创建的函数内。一般地, feval可求出有大量输入 参量的函数值,例如, feval(fun,x,y,z)等价于求fun(x,y,2)值 列在上面表中的许多字符串函数提供了基本的字符串语法分析能力。例如, findstr返 回一个在另一个字符串内字符串的起始下标值 >b= Peter Piper picked a peck of pickled peppers; >> findstr(b, find space ans 6121921262937 >)findstr(,p) find the letter p >find(b==p) for single character searches the find command works too 913 >findstr(b, 'cow) find the word cow >findstr(b, pick find the string pick ans 13 注意这个函数对大小写是敏感的,当不匹配时,返回空矩阵。 findstr对字符串矩阵不 起作用 》 strep(b,p’"P) o capitalize all ps Peter PiPer picked a peck of pickled pePPers >)strep(b, 'Peter, 'Pamela) change Peter to Pamela Pamela Piper picked a peck of pickled peppers» a=feval(' sqrt ' ,2) a = 1.4142 函数 eval,feval 的基本用途限在用户创建的函数内。一般地,feval 可求出有大量输入 参量的函数值,例如,feval(' fun ', x, y, z) 等价于求 fun(x, y, z)值。 列在上面表中的许多字符串函数提供了基本的字符串语法分析能力。例如,findstr 返 回一个在另一个字符串内字符串的起始下标值。 » b=' Peter Piper picked a peck of pickled peppers ' ; » findstr(b,' ') % find space ans = 6 12 19 21 26 29 37 » findstr(b,' p ') % find the letter p ans = 9 13 22 30 38 40 41 » find(b= = ' p ') % for single character searches the find command works too ans = 9 13 22 30 38 40 41 » findstr(b, ' cow ') % find the word cow ans = [ ] » findstr(b,' pick ') % find the string pick ans = 13 30 注意这个函数对大小写是敏感的,当不匹配时,返回空矩阵。findstr 对字符串矩阵不 起作用。 » strrep(b, ' p ', ' P ') % capitalize all p ' s ans = Peter PiPer Picked a Peck of Pickled PePPers » strrep(b, ' Peter ', ' Pamela ') % change Peter to Pamela ans = Pamela Piper picked a peck of pickled peppers
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有