MATLAB Object-Oriented Programming
Use the LineGraph Class The LineGraph class defines the simple API specified by the graph base class and implements its speciali ...
Changing properties updates the graph: d.y = rand(10,1); lg.Data = d; lg.LineColor = [0.9,0.1,0.6]; Now click Zoom Out and see t ...
See Also Related Examples “Abstract Classes” on page 12-91 See Also ...
...
Saving and Loading Objects “Save and Load Process for Objects” on page 13-2 “Reduce MAT-File Size for Saved Objects” on page 13 ...
Save and Load Process for Objects In this section... “Save and Load Objects” on page 13-2 “What Information Is Saved?” on page 1 ...
workspace. For information on restoring listeners when saving objects, see “Restore Listeners” on page 13-36. How Is the Propert ...
If the saved object derives from multiple superclasses that have private properties with same name, the struct contains only the ...
Reduce MAT-File Size for Saved Objects In this section... “Default Values” on page 13-5 “Dependent Properties” on page 13-5 “Tra ...
Avoid Saving Unwanted Variables Do not save variables that you do not want to load. Be sure that an object is still valid before ...
Save Object Data to Recreate Graphics Objects In this section... “What to Save” on page 13-7 “Regenerate When Loading” on page 1 ...
Year end properties(Transient) Chart end properties(Access = private) ChartData end methods function rf = YearlyRainfall(data) s ...
See Also Related Examples “Modify the Save and Load Process” on page 13-16 “Object Save and Load” See Also ...
Improve Version Compatibility with Default Values In this section... “Version Compatibility” on page 13-10 “Using a Default Prop ...
end end The character array, 'USA', is a good default value because: MATLAB assigns an empty double [] to properties that do no ...
Avoid Property Initialization Order Dependency In this section... “Control Property Loading” on page 13-12 “Dependent Property w ...
Dependent Property with Private Storage The Odometer class avoids order dependences when loading objects by controlling which pr ...
'Units ''%s'' is not supported.', newUnits); end end end end Suppose that you create an instance of Odometer and set the followi ...
TotalDistance = 0 TripMarker = 0 end properties(Dependent) TripDistance end methods function distance = get.TripDistance(obj) di ...
Modify the Save and Load Process In this section... “When to Modify the Save and Load Process” on page 13-16 “How to Modify the ...
«
26
27
28
29
30
31
32
33
34
35
»
Free download pdf