MATLAB Answers

mat file size compression

2 ビュー (過去 30 日間)
James Russell
James Russell 2016 年 3 月 5 日
編集済み: Walter Roberson 2016 年 3 月 6 日
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

回答 (1 件)

Jan
Jan 2016 年 3 月 5 日
編集済み: Jan 2016 年 3 月 5 日
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by