I have a (n by m) matrix , in which the elements are recalculated and replaced by new ones in each iteration. (In other words I have a loop in which the elements of the mentioned matrix are being calculated and renewed in each step). What is the best way to save and export all the matrices?
So as an example:
ne = 4
ns = 6
avec = Table[0, {ie, 1, ne}, {i, 1, ns}];
Dat = Table[avec[[ie, i]] = ie + 1;
anew = avec;
Export[NotebookDirectory[] <> "avecexample.xls", anew]
, {ie, 1, ne}, {i, 1, ns}]
but this one only exports the last avec. My first question is how to save all of them ? and in the next step, I want to know in case of more iterations , how to chose particular avecs to save (I mean for example how to save/export only the last five avecs calculated in the loop)?
Put,ExportorDumpSave. But any strategy would depend on the details of your implementation. It's not fair if you ask us to guess what is your case. Please share a minimal working example of code and data in formatted form. How heavy is each matrix, how often will you need to save? – rhermans Jul 12 '19 at 16:32SowandReapare typically used to store intermediate values and get them back at the end. See, e.g., https://mathematica.stackexchange.com/questions/181597/understanding-sow-and-reap-documentation/181603#181603 – Sjoerd Smit Jul 12 '19 at 21:02