# Determining index of range of values in a matrix

```On 19/05/20 6:40 AM, swaroop.sahoo769 at gmail.com wrote:
> Hi All,
> I am using python for doing the following:
> I have a matrix which has dimension of 174*993.
> Each row of the matrix has some numbers in the range of 30-30.5.
> I would like to determine the index of the numbers in the range of 30-30.5 in each row.
> I can determine the index of the numbers in each row by using result1=np.where(np.logical_and(R[i,:]>= 30, R[i,:]<= 30.3))
> But I would like to put the indexes in a matrix.
> That is difficult because the number of indexes in each row will be different.
> Can anyone help.

I'm probably less than sure that I've understood the problem. How will
the indexes be used once the second 'matrix' is built?

Might it help to include some examples of data-rows, plus the expected
index-row?

Are we to assume that you are using np?

As you allude, the usual structure of a "matrix" is that the number of
'columns' in each 'row' is the same. However, the indexes might
constitute a "sparse matrix".

Python however, has no 'matrix' data-structure, but does allow lists to
contain lists (or dict[ionaries] to contain dicts) as a 2D
data-structure. A list has no constraint, and no expectation that each
'row' has the same number of columns.
--
Regards =dn

```