NoteUsing an editor other than the MATLAB editor or using MATLAB Online™ can
result in delays to automatic updating.
Consequences of Automatic Update
MATLAB follows a set of basic rules when updating existing objects. An automatic update
can result in:
- Existing objects being updated to the new class definition.
- An error if MATLAB cannot convert the objects to the new class definition or if there is
an error in the class definition itself.
Here is an example of what happens when you create an instance of a concrete class edit
the class definition to make the class abstract.
a = MyClass;
% Edit MyClass to make it Abstract
a
Error using MyClass/display
Cannot update object because the class 'MyClass' is now abstract.
NoteMATLAB does not update metaclass instances when you change the definition of a
class. You must get new metaclass data after updating a class definition.
What Happens When Class Definitions Change
MATLAB updates existing objects when a class definition changes, including the following
situations:
- Value change to handle — Existing objects become independent handles referring to
different objects. - Enumeration member added — Existing objects preserve the enumeration members
they had previously, even if the underlying values have changed. - Enumeration member removed — Existing objects that are not using the removed
member have the same enumeration members that they had previously. Existing
objects that use the removed member replace the removed member with the default
member of the enumeration.
5 Class Definition—Syntax Reference