How to find frequency of occurence of a specific element in a matrix per column??

4 ビュー (過去 30 日間)
TRAILOKYA
TRAILOKYA 2014 年 3 月 21 日
コメント済み: TRAILOKYA 2014 年 3 月 21 日
Sir i have a matrix say A=(0.1 80 55 0 55 0 55; 0.5 88 0 55 55 0 55; 2 89 55 0 55 55 0; 2.5 90 55 55 55 55 55; ...................; ...................; 40 95 55 55 0 55 0) Now i have to find the frequency of occurrence of 55 from column3:7 for a particular range of column 1 say 0-2.5. the fist and second column will have the average value and the others will have only the frequency of 55 so that i will get a result matrix R of dimension 1*7. would you help me please to do this???? thanks

採用された回答

Jos (10584)
Jos (10584) 2014 年 3 月 21 日
tf = A(:,1) >= 0 & A(:,1) <= 2.5 % true, when within range
tmp = A(tf,3:7)
N55percolumn = sum(tmp==55,1)
  1 件のコメント
TRAILOKYA
TRAILOKYA 2014 年 3 月 21 日
thanks a lot it works well...sir if i want to do it for other ranges like 2.5-5, 5-7.5....27.5-40 and the result should come in the same file in the consecutive rows how should i do it using loops?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by