MatLab tip, save data in compressed mode

31 sec read

I have a mat file which is 100+M in size. It would be fine normally but since I was trying to upload it to github, it was rejected due to its big size. Fortunately there is a way to reduce the size: save it again in the compressed mode.

After I load the file, I save the variable again using the following command:

save filename variablename -v7

The parameter -v7 is the key. How does the compression perform? Originally the file (render_ch2bet) size is 103M, with -v7 parameter the file is 40.9M (render_ch2bet_compressed). By comparison, if we compress the original file using a third party program, we got ~40M (render_ch2bet.zip). If we use the -v7 option, not only we get a much smaller file and save a lot of space, we can also load it directly in MatLab.

Compressed MAT file


Don't want to miss new papers in your field? Check out Stork we developed:

nirs2img, create an image file from NIRS data

I was asked where to get nirs2img script. Here it is. The download link is at the bottom of this article. nirs2img is to...
Xu Cui
51 sec read

mergefile.m – a MatLab script to merge CSV files

My wife asked me to write a script to merge some csv files she has. Usually this can be accomplished by a simple command in...
Xu Cui
35 sec read

xjview 9.6 released

In this version, we modified the templates for 3-D render view and use a high-resolution template. It also includes a few scalp view. You...
Xu Cui
31 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *