可利用下面这段代码进行cell中的查找,可直接复制使用。
function [ row, col ] = findInCell( var,cellArray )
% Description: Find the index of element in a cell array
% Input: var: value to be seached
% cellArray: cell array to search var
% Output: row: row index
% col: corresponding column index
% demo: suppose A and B are two cell arraies,
% [x y] = findInCell(A{1},B) searches the first element of A in B
[row,col] =ind2sub(size(cellArray),find(cellfun(@(x)strcmp(x,var),cellArray)));
end