classdef Num properties value end methods % Constructor function self = Num(n) [self.value] = n; end % Accessor function disp(self) self.value end % Mutator function self = add(self, v) [self.value] = [self.value] + v; end end end
function numTest() % Create a Num Object n = Num([1 2 3 4]); % Call Vectorization Method n = n.add(10); %[11 12 13 14] n.disp(); end