cell矩陣中字符的檢索不能直接使用等號,可以使用strcmp函數判斷兩個輸入字符串是否相等
1 c = strcmp( s1 , s2 ) 2 if c == 1 3 s1 = s2 4 else 5 s1 ~= s2
使用find函數進行進一步檢索,得到cell中特征字符串的位置,find返回指定字符串的索引地址
idx = find( strcmp( cell , s ) //查找cell中字符串s的位置 , idx 表示一個矩陣 if isempty( idx ) fprintf( 1 , '%s deesn't exsit in cell\n' , s ); else fprintf( 1 , ' find %s\ n' , s );