How to find the number of ones in each column of a logical matrix?

3 ビュー (過去 30 日間)
Rightia Rollmann
Rightia Rollmann 2017 年 2 月 11 日
コメント済み: Star Strider 2017 年 2 月 11 日
How to find the number of ones in each column of a logical matrix?

採用された回答

Star Strider
Star Strider 2017 年 2 月 11 日
編集済み: Star Strider 2017 年 2 月 11 日
Use the sum function.
Example:
A = logical(randi([0 1], 10,5)); % Create Data
Ones_In_Each_Column = sum(A) % Sum The Columns
EDIT Added ‘Example’ code.
  4 件のコメント
Rightia Rollmann
Rightia Rollmann 2017 年 2 月 11 日
Gotcha! Thanks!
Star Strider
Star Strider 2017 年 2 月 11 日
My pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeParticle & Nuclear Physics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by