フィルターのクリア

Hi,,I am trying to calculate the weight of a matrix.how can i do that> I am explaining below

1 回表示 (過去 30 日間)
Suppose I have a matrix...
A = [1 0 0 0 ;
1 1 0 0 ;
1 1 1 0 ;
1 1 1 1]
how do I calculate that how many coulmns have only one ONE ? TIA

採用された回答

the cyclist
the cyclist 2016 年 5 月 31 日
numberOfColumnsThatHaveExactlyOneOne = sum(sum(A==1)==1);
  3 件のコメント
nafila aytija
nafila aytija 2016 年 6 月 2 日
Is it possible to do the same with the rows?? TIA
the cyclist
the cyclist 2016 年 6 月 2 日
numberOfRowsThatHaveExactlyOneOne = sum(sum(A==1,2)==1,1);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by