Couldn't find what's wrong

1 回表示 (過去 30 日間)
IBM watson
IBM watson 2019 年 3 月 22 日
コメント済み: madhan ravi 2019 年 3 月 22 日
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 Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by