I think I have found in the meantime something that seems -so far- to do exactly what I was aiming at: make the new class inherit from MATLAB's standard double class:
classdef ChannelDouble < double
properties
units
end
methods
function this = ChannelDouble(data, units)
this = this@double(data);
this.units = units;
end
end
end
This class delivers:
>> ch1 = ChannelDouble([1:10], 'm')
ch1 =
1×10 ChannelDouble array with properties:
units: 'm'
double data:
1 2 3 4 5 6 7 8 9 10
>> ch1.^2 % <--- Standard notation returns the data just like a double array would do
ans =
1 4 9 16 25 36 49 64 81 100
>> ch1.units
ans =
'm'
If anybody can think of a better solution your, please let me know. Otherwise I will leave this reply here in case it can help somebody with a similar problem.