I have an object from some class that I wrote in Matlab. When I use the “whos” command to determine its size, it is approximately 720,000 bytes. When I save it in a .mat file, it takes about 75 MB. What's happening?
Is there an efficient way to save and load an object in Matlab?
EDIT: Here is a list of properties and their size
CT_COL: 2
p: 5
d: 10
n: 37
N: 20
idx: [20x1 double]
Am: [4-D double]
X: [4-D double]
y: [37x1 double]
KGram: [20x20 double]
reWave: []
rpw: 2
grps: [1x37 double]
exIDX: [1 4 5 6 13]
nCV: 100
prIDX: [100x6 double]
trIDX: [100x26 double]
U: [5x100 double]
V: [10x100 double]
B: [20x100 double]
Yhat: [37x100 double]
Lam: [100x1 double]
peakRatio: [37x1 double]
Both Am and X are 20x10x5x37 arrays (double)
By the way, the "reWave" property is used to store the method handle of another object. I thought this might not be a good idea (and might be the reason for this), so I removed all mention of this from the class definition. But it somehow appears in a set of properties. (Even after I released "clear classes.")
EDIT2: I use the command save('uvXbMod1.mat','ob') to save only an object. Here comes the riddle: when I use the command whos -file uvXbMod1.mat to see what is stored inside the file, it shows
Name Size Bytes Class Attributes
ob 1x1 680512 uvXbModel
( , .) .mat, ?
EDIT3: ... , . , @(X) median(abs(X),2) @median . , , , , (?). , -, , ( ...)