From: Matt J on 29 Jul 2010 17:11 "Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i2sp75$pl3$1(a)fred.mathworks.com>... > I still don't quite understand this. I don't see how the instance of myClass2 can store less than 15 doubles, which ought to take 120 bytes. ================= Again, it's not a question of what the class instance stores. It's a question of what whos() reports. Handle class data is apparently not accounted for in whos(), as you can see from the following experiment. This is a 1-property version of myClass with constructor that let's you set the property's value: classdef myClass < handle properties prop1 = []; end methods function obj=myClass(x) if nargin obj.prop1=x; end end end end %%%%%%% And now do >> clear classes; a=myClass(rand(1000)); b=myClass(1); whos Name Size Bytes Class Attributes a 1x1 60 myClass b 1x1 60 myClass Confused? Understable, but there are lots of handle-like things in MATLAB that behave this way. Anonymous functions, for example, can consume all kinds of large memory blocks to hold the fixed parameters of the function. There's no way to detect that memory consumption using whos(). |