# How to find number of Zeros and ones in the matrix?

#### svp

##### New member
The given matrix is N X M matrix which has elements equal to Zero, one and 'X'.. Generally this matrix will have very elements equal to Zeros or Ones but majority of elements equal to 'X'. This is the matrix generated by Electronic circuit. The size of the matrix is too big. Hence I would like to find total number of elements equal to Zero or one. The basic idea is to find sparseness and density of the matrix based on count of elements equal to zero or one. The matrix looks like: $$\begin{matrix} 1 & 0 & x & x & x & x & 0 & x & 0 & x & 1\\ x & x & x & x & 0 & x & x & x & x & x & 0\\ 0 & x & x & x & x & 1 & x & 1 & x & x & x\\ \end{matrix}$$

Last edited:

#### Harry_the_cat

##### Senior Member
The given matrix is N X M matrix which has Zero, one and 'X' as an elements. Usually this matrix will have very less Zeros and Ones but more 'X'. Here 'X' is not variable and it could be fixed number. The matrix looks like: $$\begin{matrix} 1 & 0 & x & x & x & x & 0\\ x & x & x & x & 0 & x & x\\ 0 & x & x & x & x & 1 & x\\ \end{matrix}$$