1
如何檢查某個特定變量的字符串值是否存在於數組中?我知道strcmp
和ismember
是選項,但是我將如何適應這些,以便他們使用變量的值在數組中搜索,而不是在我輸入要搜索的字符串中。所以我的代碼看起來是這樣的:在數組中搜索變量
C1 = {'red' 'yellow'};
C2 = {'green' 'blue'};
fn = 'blue';
%Comparison function here
if % fn is present in C1
c = 'm'
感謝
我認爲regexp是更快,雖然:) –