matlab cell does not support solutions find find

The following code can be used to find cell in direct replication.

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

Released seven original articles · won praise 0 · Views 404

Guess you like

Origin blog.csdn.net/weixin_44035267/article/details/104535156