MATLAB Object-Oriented Programming
showImage(img1(100:200,1:160)); Subscripted reference operations (controlled by the inherited subsref method) return a DocUint8 ...
50 100 150 200 250 50 100 150 200 250 Concatenation Operations Concatenation operations work on DocUint8 objects because this cl ...
50 100 150 200 250 300 350 400 450 500 50 100 150 200 250 Data Operations Methods that operate on data values, such as arithmeti ...
function o = times(obj,val) u8 = uint8(obj).*val; o = DocUint8(u8); end When you override a uint8 method, MATLAB calls the subcl ...
50 100 150 200 250 50 100 150 200 250 See Also Related Examples “Operator Overloading” on page 17-47 “Subclasses of Built-In Ty ...
Subclasses of Built-In Types with Properties In this section... “Specialized Numeric Types with Additional Data Storage” on page ...
Property Added The ExtendDouble class defines the DataString property to contain text that describes the data. The superclass pa ...
data = 0; str = ''; elseif nargin == 1 str = ''; end obj = obj@double(data); obj.DataString = str; end function sref = subsref(o ...
d = double(obj); newd = subsasgn(d,s(2:end),b); obj = ExtendDouble(newd,obj.DataString); end otherwise error('Not a supported in ...
Using ExtendDouble Create an instance of ExtendDouble and notice that the display is different from the default: ed = ExtendDoub ...
This class implements the following subscripted indexing expressions for reference and assignment. obj.DataString — access the ...
ed = One to thirteen' 1 2 3 4 5 6 7 8 9 10 11 12 13 The ExtendDouble inherits converter methods from the double class. For examp ...
The increased flexibility of the implementation of indexed reference in the ExtendDouble class. Concatenation of ExtendDouble Ob ...
See Also Related Examples “Subclasses of Built-In Types Without Properties” on page 12-60 12 How to Build on Other Classes ...
Use of size and numel with Classes In this section... “size and numel” on page 12-77 “Built-In Class Behavior” on page 12-77 “Su ...
numel(d) ans = 10 dsub = d(7:end); size(dsub) ans = 1 4 The double class defines these behaviors, including parentheses indexing ...
numel(sd) ans = 10 Object arrays return the size of the superclass arrays: size([sd;sd]) ans = 2 10 numel([sd;sd]) ans = 20 The ...
ans = 1 1 numel(vs) ans = 1 size([vs;vs]) ans = 2 1 numel([vs;vs]) ans = 2 vs is a scalar object. The Value property is an array ...
Create an array of VerySimpleClass objects: vsArray(1:10) = VerySimpleClass; The Value property for array elements 2 through 10 ...
Other MATLAB functions use the values returned by these functions. If you change the way that size and numel behave, ensure that ...
«
24
25
26
27
28
29
30
31
32
33
»
Free download pdf