Get number of occurrences of value in a specific position in matrix

1 回表示 (過去 30 日間)
Orongo
Orongo 2019 年 2 月 14 日
コメント済み: KSSV 2019 年 2 月 15 日
Hi, I have simulated 10,000 matrices and am setting up a Chi-square test and want to count the number of times a value has appeared in a given location in the matrix. Each matrix has the dimension 101x19. How can this be set up??
For example,
A1=[1 2 3; 4 5 6];
A2=[2 2 3; 4 5 6];
A3=[1 2 3; 4 5 6];
then number of occurences of 1 in cell (1,1) is 2. Now I have 10000 matrices, each of dimension 101x19.
  1 件のコメント
madhan ravi
madhan ravi 2019 年 2 月 14 日
Illustrate with a short 2by2 3D matrix.

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

回答 (1 件)

KSSV
KSSV 2019 年 2 月 14 日
As you know the locations.....you have indices in hand.....pick those values......check with your value:
iwant = nnz(matrixvalues==val) ;
If you have flottant
tol = 10^-3 ;
iwant = nnz(abs(matrixvalues-val)<=tol) ;
  4 件のコメント
Orongo
Orongo 2019 年 2 月 15 日
no
KSSV
KSSV 2019 年 2 月 15 日
why ?

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

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by