MATLAB Answers

mat file size compression

10 views (last 30 days)
James Russell
James Russell on 5 Mar 2016
Edited: Walter Roberson on 6 Mar 2016
I have two files (examples from a large dataset) with apparently identical contents. One takes 3.2 MB disk space, the other 15 MB disk space. I understand that Matlab incorporates an algorithm for compression, but why would it behave so differently in one case than in the other?
Some high level stats on them (they appear to be identical in all respects, at all levels of the struct)(rec327 and recPTL are working names in memory here for the contents of TVFR-327-G-STV.mat and PTL-293238CA03.mat, each simply loaded into memory and renamed from their internal struct name to distinguish them here)
>> whos rec327
Name Size Bytes Class Attributes
rec327 1x1 16127172 struct
>> whos recPTL
Name Size Bytes Class Attributes
recPTL 1x1 16127172 struct
whos -file TVFR-327-G-STV.mat
Name Size Bytes Class Attributes
rec 1x1 16127172 struct
>> whos -file PTL-293238CA-3.mat
Name Size Bytes Class Attributes
rec 1x1 16127172 struct
foo =
4x1 struct array with fields:
name
date
bytes
isdir
datenum
>> foo(3)
ans =
name: 'PTL-293238CA-3.mat'
date: '13-Feb-2016 17:27:20'
bytes: 15040532
isdir: 0
datenum: 7.363737273148148e+05
>> foo(4)
ans =
name: 'TVFR-327-G-STV.mat'
date: '01-Mar-2016 19:48:36'
bytes: 3200147
isdir: 0
datenum: 7.363908254166667e+05

  0 Comments

Sign in to comment.

Answers (1)

Jan
Jan on 5 Mar 2016
Edited: Jan on 5 Mar 2016
There can be several reasons. E.g. the compression works differently accoring to the entropy of the data. It matters, if the file was saved at once or if data have been appended or pertially overwritten. There are different MAT file formats, see -v4, -v6, -v7, -v7.3 flags for save.

  0 Comments

Sign in to comment.


Translated by