# Extracting Data from For Loop

I want to add phases in for loop and after adding a new phase I want to export this data? How can I do this? Can you show me where I do wrong?

m = (BesselJ[0, LP0na[[n]]*(x^2 + y^2)^0.5/5]*Cos[0*ArcTan[x, y]]*
Exp[-I*Sqrt[(1.476*2*Pi/1.55)^2 - (LP0na[[n]]/5)^2]*10^4 +
i*0.25*Pi]);

k= (BesselJ[0, LP0na[[n]]]/
BesselK[0, Sqrt[4.459^2 - LP0na[[n]]^2]] BesselK[0,
Sqrt[4.459^2 - LP0na[[n]]^2]*(x^2 + y^2)^0.5/5]*
Cos[0*ArcTan[x, y]]*
Exp[-I*Sqrt[(1.476*2*Pi/1.55)^2 - (Sqrt[4.459^2 - LP0na[[n]]^2]/
5)^2]*10^4 + i*0.25*Pi]);
n = Table[
If[(x^2 + y^2) < 25, m, k], {x, -6, 6, 0.241/5}, {y, -6, 6,
0.241/5}];
For[i = 0; n = x, i < 8, i++, n = n; Print[n]]

• What do you get as output? – Kiro Apr 19 '17 at 8:58
• @Kiro I can not get any output. Actually I want to get a matrix and which phase makes total matrix elements maximum. – halil ibrahim Binici Apr 19 '17 at 9:07
• It's unclear to me what you are asking. What is the form of the matrix elements? – Kiro Apr 19 '17 at 9:37
• Can you break this problem up into smaller pieces that are easy to explain? You say you are trying to create a matrix. Perhaps you could try creating a simpler matrix first, and make it slightly more complicated until you find a problem? – jjc385 Apr 19 '17 at 16:05