MATLAB Object-Oriented Programming
Representing Hardware with Classes In this section... “Objective” on page 12-83 “Why Derive from int32” on page 12-83 “Implement ...
end methods function obj = MuxCard(inptnames, inptrates, outpname) obj = obj@int32(inptrates); obj.InPutNames = inptnames; obj.O ...
OutPutName: 'outp' OutPutRate: 75 int32 data: 3 12 12 48 Call Methods of int32 Use a MuxCard object like an array of int32 value ...
See Also Related Examples “Subclasses of Built-In Types with Properties” on page 12-68 12 How to Build on Other Classes ...
Determine Array Class In this section... “Query the Class Name” on page 12-87 “Test for Array Class” on page 12-87 “Test for Spe ...
Numeric values (floating-point and integer values): isa(a,'numeric') ans = 1 isa Returns True for Subclasses isa returns true fo ...
ans = SubInt Use the strcmp function with the class function to check for a specific class of an object: a = int16(7); strcmp(cl ...
Test for Category of Types Suppose that you create a MEX-function, myMexFcn, that requires two numeric inputs that must be of ty ...
Abstract Classes In this section... “Abstract Classes” on page 12-91 “Declare Classes as Abstract” on page 12-92 “Determine If a ...
MATLAB does not force subclasses to implement concrete methods with the same signature or attributes. Abstract classes: Can def ...
methods (Abstract) abstMethod(obj) end For methods that declare the Abstract method attribute: Do not use a function...end bloc ...
output = absMethodTwo(obj) end end Use the logical value of the meta.class Abstract property to determine if the class is abstra ...
Determine if you implemented all inherited class members using meta.abstractDetails: meta.abstractDetails(?SubAbsClass) Abstract ...
Define an Interface Superclass In this section... “Interfaces” on page 12-96 “Interface Class Implementing Graphs” on page 12-96 ...
Interface Properties and Methods The graph class specifies the following properties, which the subclasses must define: Primitiv ...
Allowing each specialized GraphInterface object to implement whatever additional properties it requires to give class users con ...
'Callback',@(src,evnt)zoom(gobj,2),... 'Position',[100 20 60 20]); end end end The GraphInterface class implements the property ...
Add Properties The LineGraph class implements the interface defined in the GraphInterface class and adds two additional properti ...
gobj.AxesHandle = get(h,'Parent'); end Implement the zoom Method The LineGraph zoom method follows the comments in the GraphInte ...
if nargin > 1 for k=1:2:length(varargin) gobj.(varargin{k}) = varargin{k+1}; end end end end function gobj = draw(gobj) if is ...
«
25
26
27
28
29
30
31
32
33
34
»
Free download pdf