I have a for loop which generates random matrices and then some scalar numbers for example:

For[j = 1, j <= 100, j++,a=RandomState[4];b=RandomState[4];c=Tr[a];d=Tr[b];e=b+c;{a,b,c,d,e}>>>file.csv] data=Import["file.csv path","Data"]


I need to save this data to a new file and then import to plot for example c against d and perform some other numerical calculations. I have tried the above however it does not work. Here RandomState is from the QI package.

  • 1
    $\begingroup$ What is >>>? Why not use Export? $\endgroup$ Apr 30 at 14:01
  • 1
    $\begingroup$ I just learned that >>> is equivalent to PutAppend. Either use Export/Import or Put/Get. And Put does not write in CSV format, it writes the InputForm of an expression. Check the documentation. $\endgroup$ Apr 30 at 22:12
  • $\begingroup$ I think there is at least one duplicate to this question. Can you check whether the answer to this question solves your problem? $\endgroup$ May 1 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.