We can use .txt as well
L = 50;
usol = NDSolve[{I D[u[t, x], t] + D[u[t, x], x, x] +
2 Abs[u[t, x]]^2 u[t, x] == 0.1 (1 - Cos[Pi x/L]),
u[0, x] == Sech[x] Exp[I x], u[t, -L] == u[t, L]},
u, {t, 0, 1}, {x, -L, L}]
usolE = First[u /. usol]
Export["C:\\Users\\...\\Desktop\\Schrodinger.txt", \
usolE]
Usol = ToExpression[
Import["C:\\Users\\...\\Desktop\\Schrodinger.txt"]]
In[16]:= Head[Usol]
Out[16]= InterpolatingFunction
{Plot3D[Abs[usolE[t, x]], {t, 0, 1}, {x, -L, L}, PlotRange -> All,
ColorFunction -> Hue, Mesh -> None, PlotPoints -> 50],
Plot3D[Abs[Usol[t, x]], {t, 0, 1}, {x, -L, L}, PlotRange -> All,
ColorFunction -> Hue, Mesh -> None, PlotPoints -> 50]}
