Couldn't find what's wrong

1 次查看(过去 30 天)
a=cell(1,3)
a{2}= [2 4 5]
for i=1:3
if numel(a{i})==3
b=cellfun(@(q) q==a(i),a,'un',1)
end
end
I tried to find index of the matrix which have a certain number of elements in a cell.

采纳的回答

madhan ravi
madhan ravi 2019-3-22
编辑:madhan ravi 2019-3-22
q = 3;
b = find( cellfun( @numel, a ) == q )
%or
b = find( cellfun( 'prodofsize', a ) == q )
  2 个评论
IBM watson
IBM watson 2019-3-22
thanks but what is q=3 for ?
madhan ravi
madhan ravi 2019-3-22
Refers to number of elements you can change it accordig to your desire.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by