Save data into a text file?

Hi all,
I got the following results from Nsolve function:

{q1 -> 0.04758108019293541`, q2 -> 0.7151681255129464`,  q3 -> 0.038439916205530146`, q4 -> 0.6962707561718241`, lamda -> -3661.2680773211655`},
{q1 -> -0.038439916205530104`, q2 -> 0.696270756171824`, q3 -> 0.047581080192935436`, q4 -> -0.7151681255129464`, lamda -> -3661.2680773211655`},
{q1 -> -0.058439916205530104`, q2 -> 0.8270756171824`, q3 -> 0.047880192935436`, q4 -> -0.7151681289464`, lamda -> -3661.2680773211655`} 

Now, I want to save them into text file with this order ( form of columns):

    q1   q2   q3   q4

How can I do this please ?

If ans is the result you got from NSolve,

Export["data.csv", {q1, q2, q3, q4, lamda} /. ans]

Nsolve and many other functions return “Rules” of the form{ {q1->number},…}. You apply the rules with /. or Apply.

{q1, q2, q3, q4, lamda} /. ans

Makes a matrix of the results in the order q1,q2,q3,q4,lamda. You can export the matrix in whatever format you want – Read the documentation for Export.

Thank you for your reply.
I tried this but I got a csv file that contains just this line :

{q1	 q2	 q3	 q4	 lamda} /. ans

I tried this also :

 Export["data.txt", NSolve[{eq1, eq2, eq3, eq4, eq5}, {q1, q2, q3, q4, lamda}, Reals]]

I got this time a text file contains all results. But for me, I want just the numeric data (just the numbers) without the letters {q1,q2,q3,q4,lamda } and Symbols “->”,ie, just the valus of q and lamda.

Best regards.

I wrote “If ans is the result you got from NSolve,”

ans is not a magic keyword. I assumed you would set

ans = NSolve[...]

And then use it as I described. You really need to take ownership of your problem and learn the Wolfram language. The community can point you in the right direction but you should read the documentation and try to understand what commands we use and not consider them “black boxes”.

I hope this helps.