matlab cell不支持find查找的解决方案
作者:互联网
可利用下面这段代码进行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
a99h
发布了7 篇原创文章 · 获赞 0 · 访问量 414
私信
关注
标签:index,col,cell,cellArray,matlab,var,find,row 来源: https://blog.csdn.net/weixin_44035267/article/details/104535156