필터 지우기
필터 지우기

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개)

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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by