MATLAB copies the array when writing .
Suppose your class is parent (no need to subclass the handle):
classdef parent properties largeMatrix; end end
and your child class:
classdef child < parent methods function obj = child(parent) obj.largeMatrix = parent.largeMatrix; end end end
Now create a parent element and assign a large matrix to your largeMatrix property:
p = parent; p.largeMatrix = rand(1e4); % 750 MB circa
Check out the jump in memory:

Now create a child and make sure the data has been pointed to:
c = child(p); size(c.largeMatrix)
As you do not see a jump in memory:

Finally, make a simple change to the child data:
c.largeMatrix(1) = 1;
As you can see, only when writing the array is effectively copied :

To prevent writing to child.largeMatrix , define a property in the parent class with the attribute (Abstract = true) and in the child (SetAccess = immutable) .
source share