フィルターのクリア

how can i calculate how many number of times that 1 occurs.

1 回表示 (過去 30 日間)
vetri veeran
vetri veeran 2014 年 12 月 13 日
編集済み: Azzi Abdelmalek 2014 年 12 月 13 日
I have an array like this
x =
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
how can i calculate how many number of times that 1 occurs.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 12 月 13 日
編集済み: Azzi Abdelmalek 2014 年 12 月 13 日
x=repmat(1:4,4,1) % Example
out=sum(x(:)==1)
%or
out=nnz(x==1)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by