MATLAB Object-Oriented Programming
Class with Modified Indexing In this section... “How to Modify Class Indexing” on page 17-39 “Class Description” on page 17-39 “ ...
Create an instance of the class: obj = MyDataClass(d,'Test001') obj = MyDataClass with properties: Data: [3x4 double] Descriptio ...
The default indexed reference behavior for scalar objects: obj.Data(2,3) ans = 5 And to add the functionality to index into t ...
Specialize Subscripted Assignment — subsasgn To support the equivalent of the indexed reference behavior with indexed assignment ...
end end Implement Addition for Object Data — double and plus First, implement a double method that converts an object to an arra ...
9 6 9 2 2 1 9 9 Add 7 to the array contained in the Data property: obj + 7 ans = 15 16 10 16 16 13 16 9 9 8 16 16 MyDataClass.m ...
case '()' if length(s)<2 sref = builtin('subsref',obj.Data,s); return else sref = builtin('subsref',obj,s); end case '{}' err ...
function ind = end(obj,k,n) szd = size(obj.Data); if k < n ind = szd(k); else ind = prod(szd(k:end)); end end end end See Als ...
Operator Overloading In this section... “Why Overload Operators” on page 17-47 “How to Define Operators” on page 17-47 “Sample I ...
Whether this method can add objects of class double and the user-defined class depends on how you implement the method. When p a ...
tf = true; else tf = false; end end end end Using a double converter enables you to add numeric values to Adder objects and to p ...
Ensure that your class provides any error checking required to implement your class design. MATLAB Operators and Associated Func ...
Operation Method to Define Description a:d:b a:b colon(a,d,b) colon(a,b) Colon operator a' ctranspose(a) Complex conjugate trans ...
...
Customizing Object Display “Custom Display Interface” on page 18-2 “How CustomDisplay Works” on page 18-7 “Role of size Functio ...
Custom Display Interface In this section... “Default Object Display” on page 18-2 “CustomDisplay Class” on page 18-3 “Methods fo ...
CustomDisplay Class The matlab.mixin.CustomDisplay class provides an interface that you can use to customize object display for ...
The default object display does not include a footer. The detailed display provides more information: Part Builder Methods Each ...
Method Purpose Default getFooter Create the text used for the footer. There are two footers: Simple display — Returns an empty ...
Method Inputs Outputs convertDimensionsToStrin g Valid object array Object dimensions converted to a char vector; determined by ...
«
34
35
36
37
38
39
40
41
42
43
»
Free download pdf