# For loop to define a Matrix

Suppose I have a matrix,

Mat = MatrixForm[{{1.5, 2.83034}, {1.50476, 2.82655}}]


I need to define parameters such that in the matrix 'i'th component is 'Lambda' and 'j'th component is corresponding 'Neff' value.

How is that possible in Mathematica?

I tried this

   For[i = 0; j = 0, i < 21 ; j < 21, i++, j++; Map[LambdaSS[i], NefS1[j]] = Mat[i, j]]


However, this generates error.

• Don't use MatrixForm. It is only a wrapper meant for display purposes. – Henrik Schumacher Feb 12 at 10:41
• And, almost certainly, the sub-expression Map[...] is going to cause grief later. Is the assignment the wrong way round ? OP might want to investigate the Array function for programmatic construction of arrays. – High Performance Mark Feb 12 at 11:23
• Moreover, indexing into a matrix has to be done with Part, so it should be Mat[[i,j]]. See also The Four Kinds of Bracketing in the Wolfram Language. Moreover, For loops are evil. – Henrik Schumacher Feb 12 at 11:49
• @HenrikSchumacher : I removed the MatrixForm. I understand the indexing using Part. However, here I don't need to index individiual entries in the matrix. I want to have a standard definition which signifies that Matrix [LambdaSS, NefS1] = Mat[[i,j]. – user35115 Feb 14 at 11:15
• @HighPerformanceMark: Thanks for your inputs. Actually, I need to plot a function with variable LambdaSS. The values of LambdaSS should be limited to the arrray. That is to say it can only take 2 values 1. 5 and 1.50476 if we were to consider the above array – user35115 Feb 15 at 7:56