I have generated eigenvalues of '1' 1000x1000 matrix of CircularOrthogonalEnsemble and saved it in a csv file using Export. Now I want to save eigenvalues of another '1' 500x500 matrix of COE in the same csv file. How can I do that? In total, I want 100 csv files of eigenvalues combining eigenvalues of both the 500x500 matrix and the 1000x1000 matrix

  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Oct 24 '21 at 14:58

As a simpler example, I have two lists: the first one has integers and the second one has real numbers in arrays of different sizes.

alist = RandomInteger[{-10, 10}, {10, 10}];
blist = RandomReal[{-1, 1}, {5, 5}];

Let's say you have written a csv file using:

fName = "C:\\test.csv";
Export[fName, alist, "CSV"]

You can now open the file for appending as a stream first.

strm = OpenAppend[fName]
Export[strm, blist, "CSV"]

Don't forget to close the stream.


enter image description here

To import back in Mma:

clist = Import[fName, "CSV"]
clist // TableForm

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.