フィルターのクリア

question on cell array

2 ビュー (過去 30 日間)
jana
jana 2014 年 1 月 24 日
編集済み: Image Analyst 2014 年 1 月 25 日
I have a 2x2 cell array (this is just an example, I am dealing with a large matrix)
Sc{1,1} = [1,2];
Sc{1,2} = [1,3,4];
Sc{2,1} = [2,3];
S{2,2} = [2];
I want to count the number of elements in each cell and check if it is greater than 2 or not. for example: the number of elements in Sc{1,1} = 2 which is not grater than two. Similarly the number of elements in Sc{1,2} = 3 which is greater than two ad so on.
I dont know how to implement it. Please help!..I am fairly new to matlab!

採用された回答

Image Analyst
Image Analyst 2014 年 1 月 25 日
編集済み: Image Analyst 2014 年 1 月 25 日
Try this:
numArrayElements = cellfun(@numel, Sc) % Just FYI.
morethan2 = cellfun(@numel, Sc) > 2 % Logical array

その他の回答 (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