# Export a big matrix with variables and functions

I googled a lot but didn't find a solution that works for me.

The thing is, I have a very big matrix, est. $8000 \times 8000$ in size and bigger. The calculation of the matrix takes a lot of time, and as I want to use the matrix a few times, I wanted to export it for later usage - which works. I export it as a ".m" file, but this file is about 300 MB in size. I can't save it as a ".dat" oder ".mat", because the matrix involves the function $f[t]$ for some values of $t$. The function $f$ is not defined yet, so it has to stay in the form of, for example $\{\{f[0],2\},\{0,f[2]\}\}$. Sadly, Mathematica won't let me export it as a ".mat" as it does't involve just numerical values, and ".dat" doesn't work because if I import it again, it won't stay in the matrix-form.

Is there any possibility to save my matrix with undefined functions as a small file like ".dat"?

Thanks already!

• What's wrong with the .m file? 300 MB is a very reasonable and manageable file size. – AccidentalFourierTransform Feb 5 '18 at 4:08
• Thank you! I actually thought 300MB was too big...but apparently the .txt file (even though it won't let itself import properly) has about the same size. – Martin Feb 7 '18 at 9:04