These save / load data to a MAT-file inside temporary directory. At most platforms temp directories are cleaned automatically at every boot, so these scripts are perfect for managing temporary results while keeping working directory clean (e.g. you don't need to care about erasing these *.mat files).
SAVETMP and LOADTMP are simply workaround of standard SAVE and LOAD functions and build in function TEMPDIR. E.g.
savetmp file var1 var2
is identical to
Richard, thanks, I didn't know about it. I replaced "getmpdir" with standard "tempdir" in the updated version.
Basically, savetmp and loadtmp are just wrappers of save/load and tempdir functions, that allow to use command style, like:
savetmp mytemp a b c
It is a bit faster and more convenient than write
save([tempdir 'mytemp.mat'], 'a', 'b', 'c');
For instance, I use it a lot while debugging - I "savetmp" preliminary results that take long to calculate, then comment the section and "loadtmp" them.
But what about the built in functions tempname and tempdir? How do these improve on them?
"gettmpdir" was replaced by build in function "tempdir"