MATLAB Object-Oriented Programming

(Joyce) #1

Automatic Updates for Modified Classes


In this section...
“When MATLAB Loads Class Definitions” on page 5-51
“Consequences of Automatic Update” on page 5-52
“What Happens When Class Definitions Change” on page 5-52
“Actions That Do Not Trigger Updates” on page 5-53
“Multiple Updates to Class Definitions” on page 5-53
“Object Validity with Deleted Class File” on page 5-53
“When Updates Are Not Possible” on page 5-53
“Potential Consequences of Class Updates” on page 5-54
“Updates to Class Attributes” on page 5-54
“Updates to Property Definitions” on page 5-55
“Updates to Method Definitions” on page 5-56
“Updates to Event Definitions” on page 5-57

When MATLAB Loads Class Definitions


MATLAB loads a class definition:


  • The first time the class is referenced, such as creating an instance, accessing a
    constant property, or calling a static method of the class.

  • Whenever the definition of a loaded class changes and MATLAB returns to the
    command prompt.

  • When you change the MATLAB path and cause a different definition of the class to be
    used. The change takes effect after MATLAB returns to the command prompt.

  • Whenever you access the class metadata.


MATLAB allows only one definition for a class to exist at any time. Therefore, MATLAB
attempts to update all existing objects of a class automatically to conform to the new class
definition. You do not need to call clear classes to remove existing objects when you
change their defining class.

Automatic Updates for Modified Classes
Free download pdf