I want to export some sort of data from Mathematica to .txt files but every time with a different name.clearly I want the name of files change automatically in each loop for each series of data that are produced in each iteration.
s = -1
While[s < 2*q = 2.;
\[CapitalDelta] = 0.5;
smin = -0.3;
smax = 0.1;
\[CapitalDelta]s = 0.01;
L = 5;
p = 2^L;
s = s + 0.05;
H = {{1, 0, 0, 0}, {0, 1 - (\[CapitalDelta] + 1)*q, E^s/q, E^s/q},
{0, q E^s, 1 - (\[CapitalDelta] + 1)/q, q E^s},
{0, \[CapitalDelta]*q*E^s, (\[CapitalDelta]*E^s)/q, 1 - (q + 1/q)}};
IM = IdentityMatrix[2];
row = ConstantArray[1, p];
sum = row.H;
Export["sum,L=5,q=2,d=0.5,s=-1.txt", sum];
Export["H,L=5,q=2,d=0.5,s=-1.txt", Flatten[H], "Table"]
];
I want to change "s" in the name of the files each time with the real value of it in that itteration
Answer
Instead of "H,L=5,q=2,d=0.5,s=-1.txt"
write for example:
"H,L=5,q=2,d=0.5,s="<>ToString[CForm[s]]<>".txt"
Comments
Post a Comment