As in my previous question I have the following problem. I have a matrix P nxn which elements are matrices P{i,j} which are also nxn. So the total amount of elements is n^4. For n=100 there is an error about the lack of memory. I calculate this matrix only one time and then operate with it. Could you advise me, how to store matrices P{i,j} on the HDD?
I mean that maybe it is possible to store each of them in a file like “data_i_j.dat” and then load it while doing computations in a loop for i and j?
The
savefunction will write data to a file, and theloadfunction will read it back again.save(filename,varname,varname,varname...), followed byS = load(filename)and referring toS.varname(there’s also a version ofloadthat just dumps stuff into your current workspace, but that seems like poor practice).