Thanks, Gianluca. Although, my problem is not resolved yet.
I created a simple code that generates the same warning messages:
Eqn = {};
For[ns = 1, ns <= 2, ns++,
For[nx = 1, nx <= 2, nx++,
AppendTo[Eqn, 2*ns*Part[X, ns, nx] == nx^2]]];
Eqn
Flatten[Table[Part[X, i, j], {i, 1, 2}, {j, 1, 2}]]
NSolve[Eqn, Flatten[Table[Part[X, i, j], {i, 1, 2}, {j, 1, 2}]]]
Although I get the final solution, there are many warning messages which I want to get rid of:
Part::partd: Part specification X[[2,1]] is longer than depth of object. >>
{{X[[1, 1]] -> 0.5, X[[1, 2]] -> 2., X[[2, 1]] -> 0.25,
X[[2, 2]] -> 1.}}
Any idea to better code this problem?